How to include library directories?
I'm trying a simple QT tutorial. When I try and compile my helloworld app, it has trouble including the .h files (see below). Where and how do I include the directory containing these (I think it's /opt/kde3/qt/include)...
dave@davee:~/qt> qmake -project dave@davee:~/qt> qmake dave@davee:~/qt> make g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DNO_DEBUG -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DNO_DEBUG -DQT_NO_DEBUG -I/usr/lib/qt3//mkspecs/default -I. -I. -I/usr/include -I/include -o main.o main.cpp main.cpp:1:26: qapplication.h: No such file or directory |
I don't know much about qmake & QT, but I know that make uses a file called Makefile. Try to find the -I. -I/usr/include etc. arguments in Makefile, and add "-I/opt/kde3/qt/include". That should work, but I'm not sure if Makefile is auto-generated by qmake. If that is the case, then you should check qmake's input files / configuration to make sure that it also writes this argument in newly-written Makefiles
|
from man make
Code:
-Idir |
oops! i mean 'man gcc'
|
You seem to be under the impression that libraries and .h files are the same thing. Your title mentions library directories, then you ask about the directory containing .h files in the text.
A library and a .h file are NOT the same. A library contains object code that has the actual implementation of things. A .h file simply DECLARES the implementation of those things, it doesn't implement them. So... even if you get your INCLUDE paths working, the next thing you will probably run into is linker errors because you don't have the LIBRARY paths setup. To tell the linker about a LIBRARY, you use -llibraryname and possibly -L/path/to/library if it is not in your search paths. Sorry, if you are already aware of the distinction, but it was always a bit of a pet peeve of mine when people in my C++ classes in college would say they included a library, when what they really did was to include a header file... :) I think the confusion might have come from the fact that the standard C/C++ libraries are usually included by default so they never had to deal with actual libraries before. |
and dont forget that -llibraryname is not the actual filename either.
i.e. if you want to link a file called libMylib.a you would actually use gcc -l Mylib |
Quote:
gcc -lMylib |
Quote:
|
All times are GMT -5. The time now is 03:25 AM. |