Jump to content
  • Advertisement
Sign in to follow this  
Marmis

Dev-C++ and linker errors

This topic is 4348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I got a open-source library and it has about 7 header files. I extracted the folder which includes these files into Dev-Cpp\include\foo\. Now when I try to compile my program which includes all of these header files, it finds the actual files, but I get linker errors about having undefined references to namespace::class::function. I think it nags about every single function. Anyway, the library came with a .lib file, I'm guessing I have to do something with that. In the docs it says: This is only on Windows. Use this to link your applications to that are going to be using the foo.dll for developing applications against the api. See your Visual Studio 7.1 guide on linking against libs for using dll's for further information. As mentioned, I'm not using VS and I'm not really keen on changing to that either. I have always been using Dev-C++ and I have always relied on pre-built devpaks so I really have no clue about this. That being said, this might be an easy one for you. Thanks in advance for any help.

Share this post


Link to post
Share on other sites
Advertisement
Sounds to me like the library should have a .dll file with it as well.

I'm at work at don't have VS to hand but if you go into Project Options -> Linker -> Additional Dependancies (I think, or something like that) there is an option you can browse from to add the .lib file to your project.

You'll also need the .dll file somewhere the exe can find it when it runs as well. This would be in the same directory as your exe, in Windows, in Windows/System32 or on the PATH somewhere.

[EDIT] Sorry - just realised you said you are not using VS. Someone else will have to advise how to add the .lib to your project with DevC++.

Share this post


Link to post
Share on other sites
Ah yes, that's correct, it does have a .dll file too. I placed the .dll to the same dir where the exe would be, but that alone didn't help. I'm pretty positive something must be set in the linker/compiler options too. I'd appreciate if someone could point it out, thanks.

[Edited by - Marmis on September 20, 2006 8:14:29 AM]

Share this post


Link to post
Share on other sites
You just need to add foo.lib to your project. The .dll isn't searched for until the exe is actually run but the .lib file is needed to tell the compiler that the functions are in a .dll and the name of the .dll and so on.

I've never used Dev C++ but surely there must be an Add To Project option or something like that? If not, if you can edit the command line that is sent to the linker, just add foo.lib to the end of this line (or wherever the linker you are using expects .lib file to be specified).

Share this post


Link to post
Share on other sites
Yep, right click on the project name in the leftmost pane
-> Project Options
-> Parameters tab
-> Use the button below the right hand Linker pane to browse to the *.lib files

Share this post


Link to post
Share on other sites
Thanks, I added the .lib for the linker, but unfortunately that didn't solve it. I'm still getting the same litany of linker errors.

Where exactly should both the .lib file and the .dll file be, or does it really matter? Currently they are both in the same dir as the exe would be.

If this is how it should work, are there any other possible reasons for the linker errors?

Share this post


Link to post
Share on other sites
maybe you should add the folder with the libary and dll to your project

-> project options -> Files/directories / include files

the above might not be very corrct as my C++ is in dutch and I just translated it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
a .lib file is a library built for visual
what you need is a .a file

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
in other words, you need a file that was compiled with dev-cpp and not visual

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!