Re: linking libraries (problem solved. fault; library was c, I compiled c++)
I found the problem! It is my bad actually, the Vortex library is a C library, not a C++ library.
So,
I changed the name of dummy.cpp to dummy.c,
I changed CXXFLAGS to CFLAGS in dummy.pro as below, then run
make clean && qmake && make.
Code compiled! I feel stupid that I did not realise this earlier! :o
Thank you for the troubleshooting!
> more dummy.c
Code:
#include <vortex.h>
int main( )
{
vortex_init();
}
> more dummy.pro
Code:
TEMPLATE = app
LANGUAGE = C++
CONFIG += qt warn_on release
SOURCES += dummy.c
LIBS += $$system(pkg-config --libs vortex)
QMAKE_CFLAGS += $$system(pkg-config --cflags vortex)
unix {
UI_DIR = .ui
MOC_DIR = .moc
OBJECTS_DIR = .obj
}
> make clean && qmake && make
Code:
qmake -o Makefile dummy.pro
rm -f .obj/dummy.o
rm -f *~ core *.core
gcc -c -pipe -pthread -I/usr/local/include/vortex -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 -I.ui/ -I.moc/ -o .obj/dummy.o dummy.c
dummy.c: In function ‘main’:
dummy.c:6: warning: control reaches end of non-void function
g++ -o dummy .obj/dummy.o -L/usr/share/qt3/lib -L/usr/X11R6/lib -pthread -L/usr/local/lib -lvortex -lgthread-2.0 -lxml2 -lz -lglib-2.0 -lqt-mt -lXext -lX11 -lm -lpthread
Re: linking libraries (problem solved. fault; library was c, I compiled c++)
Quote:
Originally Posted by JustaStudent
I found the problem! It is my bad actually, the Vortex library is a C library, not a C++ library.
Then you should use Vortex headers like this:
Code:
extern "C" {
#include <vortex.h>
};
Athough it's strange that Vortex authors didn't take care of it.