Page 1 of 1

Cannot Include Libraries

Posted: Wed Dec 14, 2011 10:46 am
by blutbeere
I am sry to open another noob topic, but I dont understand what I am doing wrong.
Maybe I am trying it to hard -.- lol. This probably belongs to a usual C++ Forum, but I hope anyone can help
me out once again.
All I want to do is include another Library mysqlcppapi, Box2D or irrNetLite for example.
The program compiles fine until I include the headers. But whenever I try to include a library, it wont find the headers.
I have defined the header folders for my Linker, I just dont get the problem with this...
http://imageshack.us/f/337/errorsso.jpg

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 11:33 am
by CuteAlien
Headers are for the compiler - libraries are for the linker. So you have to set the include-paths to the header and the linker-path to the library.

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 11:58 am
by blutbeere
Wrote that wrong sry^^.
Lets take mysqlcppapi as example, I set the include paths in the search directories for the compiler
as I did with Irrlicht.
But I dont have any lib of mysqlcppapi, which I could set in the Linker :O

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 12:19 pm
by CuteAlien
The include folder you have to set seem to be in this case the parentfolder of mysqlcppapi (very that folder is called include).
And check - maybe the files really don't exist.

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 12:52 pm
by blutbeere
I have posted a link for the picture in my first post.
I have checked the folders, they include the headers and it finds mysqlcppapi.h.
And if I use the parentdirectory it wont find mysqlcppapi.h anymore...
EDIT:
Getting the same problem with enet.
I set the correct header path : F:\enet\include\enet
and it pops 20 errors that headers are missing.
If i change the header path to F:\enet\include
The compiler is missing enet.h ...

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 1:58 pm
by CuteAlien
Well - you want it to find the missing headers. So the you have to set your include path in way it does that. If it does not find mysqlcppapi.h then anymore either use a second include directory (usually bad idea) or simply use the correct relative from your include-folder (usually the right idea) like #include "include/mysqlcppapi.h"

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 2:29 pm
by blutbeere
There is no difference...
I am just wondering if I need to compile those libraries myself? But there is no CMakerList to do so.
And since the include folder exists....I am not getting the problem at all.
Btw. I have the same problem with irrNetLite, including irrnetlite.h (and its headers) is no problem,
but whenever I want to add enet.h it pops hundrets of errors caused by missing headers.
To me this is nonsense, since I included the right folders...

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 4:18 pm
by CuteAlien
Well - just check the exact output. The files mentioned in your errors must be there - relative to an include-path which you have set. As I told you above in your case the parentfolder of mysqlcppapi. Either a) the file is not there, b) you didn't set the correct include path or c) you didn't set the include path at all but for example the library path instead.

And as long as you still get include errors you shouldn't worry about anything else. This are compiler errors - it makes no difference if you even have that library at all while compiling as long as you got the right headers.

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 5:33 pm
by blutbeere
And as long as you still get include errors you shouldn't worry about anything else.
This is enough to worry about :P 3 Days now and I still cant get this to working...getting mad :>

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 6:50 pm
by CuteAlien
Yeah - what I mean is - don't start recompiling Libraries. That's a later step and has nothing to do with headers not being found. Headers problems are about compiling, libs are about linking which you can't do anyway unless you managed to compile it first.

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 7:35 pm
by blutbeere
Yeah you right, the problem is: this is used to be so easy but I still havent found a solution yet.

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 9:12 pm
by blutbeere
Either a) the file is not there, b) you didn't set the correct include path or c) you didn't set the include path at all but for example the library path instead.
I have checked them all, its still now working...please take a look at my screenshot here
ยดImage

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 10:38 pm
by zerochen
you have 2 options

first, change the include path to c:\irrlicht-1.7.2\mysqlcppapi-2.0.0
and include the file with #include <mysqlcppapi\mysqlcppapi.h>

second, change in mysqlcppapi.h #include "mysqlcppapi\mysqlcppapi_internal.h" to #include "mysqlcppapi_internal.h"

Re: Cannot Include Libraries

Posted: Wed Dec 14, 2011 11:13 pm
by CuteAlien
Uhm - I already wrote 2 times that you should use the parentfolder (!) of mysqlcppapi - why don't you just do that? So yeah - exactly like zerochen describes in his first solution.

Don't do the second thing if that is a library you include. Changing library-headers is nearly always a very bad idea (unless it's a configuration-header, but that's another topic).

Re: Cannot Include Libraries

Posted: Thu Dec 15, 2011 2:21 pm
by blutbeere
and include the file with #include <mysqlcppapi\mysqlcppapi.h>
thanks alot zerochen.

Sry Michael for not understanding you, I didnt see the forest for trees :).
The whole time I was trying to change the include path to the directory folder xD

Thanks for help guys