Jump to content

  • Log In with Google      Sign In   
  • Create Account


How do I add librarys in visual studio 10?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 LiziPizi   Members   -  Reputation: 74

Like
1Likes
Like

Posted 02 May 2014 - 03:30 PM

Hey people, 

im learning through Nehe tutorials and I need to add that glaux library to my project.

How do I do that in VS? 

 

sorry for that noobie question, plz don't start bedevil me..


Edited by LiziPizi, 03 May 2014 - 02:27 AM.


Sponsor:

#2 Burnt_Fyr   Members   -  Reputation: 1197

Like
2Likes
Like

Posted 12 May 2014 - 09:15 AM

You will need to setup the library directory (project->properties->configuration properties->vc++ directories) if glaux is not in a directory already accessible by the project, as well as the add the library as an additional dependency (project->properties->configuration properties->linker->input) If you are compiling glaux, you can add that project to the existing solution, and use project->properties->common properties->add new reference instead.

 

If you are including files such as headers, you may need to setup those as well, either as an include from vc++ directories, or through  c/c++->general->additional include directories.

 

the above applies to vs2010, but should work in 2013 unless everything has been changed again.



#3 Vortez   Crossbones+   -  Reputation: 2688

Like
3Likes
Like

Posted 12 May 2014 - 03:27 PM

My favorite method is by using the #pragma comment, ex:

 

#pragma comment(lib, "LibraryName.lib")    

 

Of course, you have to add the library path in "project->properties->configuration properties->linker->General->Additional Library path"
 

Same thing for headers, in "project->properties->configuration properties->c/c++->General->Additional include directories"



#4 onetwothreegone   Members   -  Reputation: 164

Like
1Likes
Like

Posted 12 May 2014 - 06:27 PM

Important to note when using Burnt_Fyr solution, it you probably want to go to the drop down box at the top and set the configuration to All Release, otherwise it could fail when you build the release version. You don't have to do this, but it makes it easier as you don't have to manually add the libraries to all the configurations.



#5 Vortez   Crossbones+   -  Reputation: 2688

Like
0Likes
Like

Posted 13 May 2014 - 06:41 PM

Ok, who's the idiot who keep downvoting me and don't have the balls to tell why??? The information i provided is 100% accurate and lots of people do it that way i dont see why i should get downvoted for this. Last week i got downvoted for a post i posted in march... cmon.



#6 Kaptein   Prime Members   -  Reputation: 1844

Like
1Likes
Like

Posted 13 May 2014 - 06:48 PM

Ok, who's the idiot who keep downvoting me and don't have the balls to tell why??? The information i provided is 100% accurate and lots of people do it that way i dont see why i should get downvoted for this. Last week i got downvoted for a post i posted in march... cmon.

 

Maybe because it was compiler specific. I upvoted anyway since he specifically asked for VS solution.



#7 Karsten_   Members   -  Reputation: 1446

Like
1Likes
Like

Posted 14 May 2014 - 11:06 AM

My favorite method is by using the #pragma comment, ex:

 

#pragma comment(lib, "LibraryName.lib")    

 

I do like the idea of the #pragma solution since for example if you use the GLUT_STATIC or GLEW_STATIC define then the #pragma can be put in the correct #ifdef and link against the static version of the library (glut_static.lib) rather than the dynamic version. This means that you do not need to worry about the linker and build system becoming unsynced with the code.

 

However since I always try to write the most portable code I can, I guess I will never use it until 99% of compilers (especially on UNIX) support this type of linking ;)


Edited by Karsten_, 14 May 2014 - 11:07 AM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#8 Burnt_Fyr   Members   -  Reputation: 1197

Like
1Likes
Like

Posted 14 May 2014 - 12:21 PM

Ok, who's the idiot who keep downvoting me and don't have the balls to tell why??? The information i provided is 100% accurate and lots of people do it that way i dont see why i should get downvoted for this. Last week i got downvoted for a post i posted in march... cmon.

I feel your pain, it seems silly to be punished for a valid answer. #pragma comment may be VS specific, but so was my answer.



#9 Burnt_Fyr   Members   -  Reputation: 1197

Like
1Likes
Like

Posted 14 May 2014 - 12:26 PM

Important to note when using Burnt_Fyr solution, it you probably want to go to the drop down box at the top and set the configuration to All Release, otherwise it could fail when you build the release version. You don't have to do this, but it makes it easier as you don't have to manually add the libraries to all the configurations.

I didn't advise this, as OP may have different dependencies for debug and release. My own code is broken into several libraries, and each has a separate debug/release config, so when I'm including that library in a debug configuration, I want the debug config of that library, which may have sanity checks or evil helper functions for quick and dirty testing, that I shouldn't rely on in release versions. When I'm compiling a release, I use the stripped down release versions of my libraries.


Edited by Burnt_Fyr, 14 May 2014 - 12:26 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS