Unsolved cannot find -lQtOpenGL and -lGL
-
I have problem that I'm missing those two libraries to compile, but mesa-common-dev is installed, what else should I try?
Here is the main.cpp file:
#include "mainwindow.h"
#include <QApplication>
#include <QtMultimediaKit/QMediaPlayer>
#include <QtMultimediaKit/QMediaPlaylist>
#include <QtMultimediaKit/QVideoWidget>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMediaPlayer *player = new QMediaPlayer;QMediaPlaylist *playlist = new QMediaPlaylist(player); playlist->addMedia(QUrl("http://example.com/myclip1.mp4")); playlist->addMedia(QUrl("http://example.com/myclip2.mp4")); QVideoWidget *videoWidget = new QVideoWidget; player->setVideoOutput(videoWidget); videoWidget->show(); playlist->setCurrentIndex(1); player->play(); //MainWindow w; //w.show(); return a.exec();
}
and here is my .pro file:
#-------------------------------------------------
Project created by QtCreator 2015-11-25T00:07:36
#-------------------------------------------------
QT += core gui multimedia opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = videoplayer
TEMPLATE = appINCLUDEPATH += /usr/include/QtMultimediaKit
INCLUDEPATH += /usr/include/QtMobilitySOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
-
Hi,
Please search the forum a bit, that question has been asked many times already. You are missing the OpenGL dev package e.g.
apt-get install libgl1-mesa-dev
-
Hey @SGaist I already installed it and problem is the same.
-
What version of Qt are you using ?
-
@SGaist Qt 4.8.6 :)
-
Did you re-run qmake after adding
QT += opengl
?If so, how did you install Qt ?
-
@SGaist I installed it from source using QtCreator 3.5.1 and Qt 4.8.6 on my Ubuntu 14.04.3 LTS Virtual Machine. I re-run it and it's the same. How to include opengl module when doing ./configure step? Is it required or it is included by default?
-
Since you built it yourself and didn't had the OpenGL dev lib, it was built without. You have to build Qt again (from scratch with a new call to configure). While you're at it, you should consider using 4.8.7.
-
@SGaist how to include opengl lib when doing ./configure. I tried ./configure -opengl es2 but I am getting errors.
-
If you installed everything it should be detected automatically. The errors is because you don't have OpenGL es2 installed. But since you're on a desktop just use the desktop OpenGL.
-
@SGaist If I am building whole project on Ubuntu desktop machine, should I use -opengl desktop or es2, because I'm building that up for BeagleBone Black?
-
So you're cross-compiling ?
-
@SGaist yes, sorry for not telling you that earlier. I need opengl for embedded (BeagleBone Black armhf) but i need to install opengl and write correct paths for embedded opengl in my qmake.conf file.
-
What distribution are you using for that board ? It should provide everything you need (headers + lib) IIRC there's already a mkspec for the BeagleBoard
-
@SGaist Debian Wheezy
-
You should take a look at this thread. The poster has provided links to an interesting Wiki to build everything you need before building Qt.