2

As stated in the subject. I am a newbie at VC++/Visual Studio and can's seem to get this one issue right.

3 Answers3

2

pragma comment (lib, "lib_name.lib")

That should do the trick.

There is probably some setting in the project properties too, but I can't check that right now.

Community
  • 1
  • 1
Jeroen Jacobs
  • 1,423
  • 3
  • 16
  • 32
  • Thanks (to (http://stackoverflow.com/users/349026/wajih), too). I don't have a .lib file available. I am writing a routine that accesses a function contained in a DLL provided by someone else. I need to resolve that function call at link time. – Ralph Friedman Mar 26 '12 at 08:31
  • @Ralph: That's an entirely different question from the one you asked. It's already been asked and answered, see for example http://stackoverflow.com/questions/2393178/creating-an-msvc-import-library-from-a-dll-that-uses-stdcall – Ben Voigt Mar 26 '12 at 13:47
  • Thanks, @BenVoight. That will definitely be useful. Meanwhile, I seem to have solved the specific problem at runtime with a combination of LoadLibrary and GetProcAddress. – Ralph Friedman Mar 26 '12 at 20:05
1

How do I reference a DLL in a VC++ project
Read through and you will get there. It is done using visual studio compiler settings. You can do it via programming as well. Check this From SO Shortcut via programming is to use the following

pragma comment (lib, "test.lib")

The library test.lib should be accessible to your program.

And finally look here if you want to add third party libraries to your project.

Community
  • 1
  • 1
0

Project Properties -> Common Properties -> Frameworks and References

MSVS2010 Screenshot

k06a
  • 17,755
  • 10
  • 70
  • 110