LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compiler/Makefile help (https://www.linuxquestions.org/questions/linux-newbie-8/compiler-makefile-help-627820/)

doxy 03-13-2008 01:24 PM

Compiler/Makefile help
 
Hello,

Im writing a gui and I have to use some libs a guy wrote. My directory structure is:
myfolder/libs/Makefile
myfolder/libs/....
myfolder/ui/Makefile
myfolder/ui/..

In ui folder there are ui files created with Qt Designer but I have 2 questions about compiler/makefile:
1) If I include file with #include <libs/HeaderExample.h> compiler says it can't find it
2) If i put complete path into #include it gives other errors (I think because they are not compiled)

Can some1 links or explain me how does it work?
Thank you very much ;)

cmnorton 03-13-2008 03:42 PM

Include problems
 
Regarding

#include <libs/HeaderExample.h>

you're going to need to do one of two things.

Modify C_INCLUDE_PATH to include the path to the parent directory of libs, or pass the same (parent directory of libs) into gcc using the -I switch.

doxy 03-14-2008 02:13 AM

Thk a lot cmnorton! Its a great help :)
I did it and now it doesn't give that error for missing file ;) But now it gives me a lot of errors when it tries to include that file :S
Libs are compiled into libs/ with Makefile file but how can I tell him that header files it includes are already compiled and how to link them with gui files?
Thk ;)

cmnorton 03-14-2008 02:10 PM

use include directives
 
Based on what you have said without any actual error messages, it sounds like you need to protect against multiple includes of the same header file, which is almost impossible to prevent.

#ifdef __MY_HEADER_FILE_INCLUDE__
#define __MY_HEADER_FILE_INCLUDE__

<... body of include file ...>

#endif /* __MY_HEADER_FILE_INCLUDE__ */


All times are GMT -5. The time now is 12:56 AM.