• ### Popular Now

• 12
• 14
• 13
• 10
• 11

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

## Recommended Posts

I recently aquired visual studio .net 2003, and can't figure out how to link to external libraries (either .lib or .dll). i've read the docs that .Net provides. They say to click the "link" tab on the Open dialog box, except that option is never there. Then i tried adding the library to the additional dependencies list, but it can't ever find the headers (and i'm assuming neither the libraries). I also tried adding it to the additional directories list, which searches for libraries to load, but that didn't work either. can someone explain how to solve this ?

##### Share on other sites
Go choose properties from the project menu, expand the Linker section on the treeview in the left side of the resulting dialog box, and then choose input. You can add additional libraries to the additional dependencies list.

If it can't find the header files it means you haven't put them in a directory the compiler can see.

##### Share on other sites
Go to Project->Add existing item... and then locate the .lib file on your hard drive and insert it into the project.

I have never needed to add .dll files to the project, I only have them in the same directory when I run the app.

[EDIT: saw the post by Monder, yes you can do it either way, and you VS.NET also supports the #pragma comment( 'lib', 'name_of_lib' )

Also, if it can't find the headers, you should go to Tools->Options->Projects->VC++ Directories and add the proper directories for header files

##### Share on other sites
ah, i got it now; made the mistake of assuming it was like vc6.
thank you both for your clear explanations.

##### Share on other sites
i ran into a problem when trying to link sdl to my project (as recommended above). i set the library include setttings to /NOLIBDEFAULT after the compiler told me to. everything seems to link correctly, except i get the following errors :
CEngine error LNK2001: unresolved external symbol __RTC_ShutdownCEngine error LNK2001: unresolved external symbol __RTC_InitBaseCEngine error LNK2001: unresolved external symbol _mainCRTStartup

does anyone know how to shut this up ?

##### Share on other sites
All the SDL linker Errors I've received have been one of these three things:
1) is main declared as int main( int, char** ), not int main()
2) is the application a Multi-threaded DLL (Project->Properties->C/C++->Code Generation->Runtime Library?
3) Are the proper lib files included (sdl.lib, sld_main.lib,...)?

Does that help, or are you still getting the error?

##### Share on other sites
In Configuration Properties->C/C++->Code Generation did you set Runtime Library to multi-threaded dll(/MD)?

##### Share on other sites
it compiles, but it still refuses to build, citing the previous errors. what i've done :
the sdl.dll (and sdl_image.dll) is in the system32 folder (likea always)
set the search path for the include files to the sdl include folder
set the search path for the static libs to the sdl libs folder
set the dll settings to /MD
included the static libs in the dependencies list

am i doing something wrong ?

wyzy
1) yes
2) yes
3) i think so

##### Share on other sites
The /NODEFAULTLIB option will stop all default libraries from being linked which is not what you want. You may need to use it to get it to ignore a specific library but you should be able to get it working without doing this by following what wyrzy said.