Page 1 of 1

How do i reference external libraries in c++?

Posted: Wed Oct 24, 2018 10:20 am
by arachnoid
Hi,

I'm trying to develop my first c++ programs. I have a background in C# and java so at least some things are familiar in this process! I've managed to write a self contained console app that creates some objects etc. I'm now trying to link in a library, mainly to handle XML input and output.

I've got the source, a lib file and a dll file.

I've set the library search path and specifically referenced the dll and the lib (on different occasions) but the namespace doesn't show up in my app. I've even deliberately put in an invalid search path and library name to try to trigger an error message to see where it's actually trying to look but it just fails on my "using namespace".

Is there some setting i need to modify to make the code use external libraries? It seems like it's not even trying to use the library settings i'm giving it?

Thanks for any help you can give. At this point i'm not sure if i misunderstand the IDE options or the way c++ works. I know if this was java I'd reference an external jar and then just declare the namespace i wanted to use but I guess there's more to that for c++

Thanks

Russell

Re: How do i reference external libraries in c++?

Posted: Wed Oct 24, 2018 12:18 pm
by eranif
In the project settings, under "Compile" section, you should point to the location of the ".h" files (header files)
Under the "Link" section, you should point the linker to the location where it can find your library + the library name.
You should, however, state which compiler do you use, which CodeLite version, which OS etc (see my signature for the "how to post" thread)

Thanks!

Re: How do i reference external libraries in c++?

Posted: Wed Oct 24, 2018 2:02 pm
by arachnoid
Hi Eranif,

Thanks for the pointers. I added references to the headers now and I'm now getting meaningful errors. I'll work through the messages I'm getting later today.

For the record I'm on windows 10, codelite 12.0.8 and mingw32

Thanks again for helping

Russell