How do i reference external libraries in c++?

CodeLite installation/troubleshooting forum
arachnoid
CodeLite Curious
Posts: 4
Joined: Fri Sep 14, 2018 12:35 pm
Genuine User: Yes
IDE Question: c++
Contact:

How do i reference external libraries in c++?

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post 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!
Make sure you have read the HOW TO POST thread
arachnoid
CodeLite Curious
Posts: 4
Joined: Fri Sep 14, 2018 12:35 pm
Genuine User: Yes
IDE Question: c++
Contact:

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

Post 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
Post Reply