konstantin_doncov
konstantin_doncov

Reputation: 2879

X11. Symbol not found: _CGLGetCurrentContext

I try to use dlib in Qt console app on OS X. So except another lines(which I removed for tests) my .pro file looks like:

LIBS += -L/opt/X11/lib -lX11
INCLUDEPATH += /opt/X11/include

Output when I run the application:

dyld: Symbol not found: _CGLGetCurrentContext Referenced from: /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
Expected in: /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL in /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo

How can I solve this?

UPD: .pro file:

QT       += core
CONFIG   += console

CONFIG += c++11

TARGET = dlibOSX

SOURCES += main.cpp \
    ../../../Downloads/dlib-19.0/dlib/all/source.cpp

LIBS += -L/Users/user/Downloads/dlib-19.0/examples/build/dlib_build

INCLUDEPATH += /Users/user/Downloads/dlib-19.0
LIBS += -L/Users/user/Downloads/dlib-19.0 

INCLUDEPATH += /usr/local/Cellar/libpng/1.6.23/include /usr/local/Cellar/jpeg/8d/include
LIBS += -L/usr/local/Cellar/libpng/1.6.23/lib -L/usr/local/Cellar/jpeg/8d/lib -ljpeg -lpng -ljpeg -lz


INCLUDEPATH += /usr/local/Cellar/opencv/2.4.13/include
LIBS += -L/usr/local/Cellar/opencv/2.4.13/lib

QT += opengl

LIBS += -lopencv_core -lopencv_imgproc -lopencv_highgui

QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT -DLIB_NO_GUI_SUPPORT

Error:

nativefont.h:27: error: 'X11/Xlib.h' file not found

Upvotes: 2

Views: 1070

Answers (1)

Evgeniy
Evgeniy

Reputation: 2511

If you need console application - why are you linking X11?

QT       += core 
CONFIG   += console

After that hello world should work

If you are using OpenGL functions from your application - add

QT += opengl

UPD: (updated question answers)

1) Here is an error:

QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT -DLIB_NO_GUI_SUPPORT

Should be -DDLIB_NO_GUI_SUPPORT

2) If you need X11/Xlib.h - install XQuartz (for OSX) or libx11-dev (Ubuntu)

Upvotes: 3

Related Questions