2

I just downloaded Visual Studio 2010, and they changed a lot since Visual Studio 2008. These options were changed: the header includes, the lib directory to add, and all changed.

I followed a series of tutorials to do that, but in the other version I just had to add the mylib.lib string in the textfield, but now I look over and over, and I can't find a place to paste that mylib.lib to link with my project.

Where can I find it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Grego
  • 2,220
  • 9
  • 43
  • 64
  • To do what? Import a lib file in to your project? – John Dibling Sep 30 '11 at 13:49
  • Yes I want to link the libcurl.lib to my project. Its already in the lib folder but I need to link it, to do that I need to find the place to type the libcurl.lib so the project knows. – Grego Sep 30 '11 at 13:51

2 Answers2

4

If you're looking for how to get a lib file imported in to your project, you can do this either by editing the project settings, under Linker>Input:

enter image description here

...or you can use a #pragma...

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

I typically add this right in to the header file for the library I want to import. Alternatively, you can add it to any header or CPP file in your project.

John Dibling
  • 99,718
  • 31
  • 186
  • 324
2

I personally prefer to do it this way, right in code:

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

This way you don't need to look for the field you need under project settings.

See also: What does "#pragma comment" mean?

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Roman Thanks for answering, where do I put this code? And what exactly is this "lib" variable, and where should my "mylib.lib" be placed? in /lib normally ? thanks! – Grego Sep 30 '11 at 13:52
  • Right in code, like this: http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/DxError/DxError.cpp#ln11 (line 11) – Roman R. Sep 30 '11 at 13:53