How can I link .lib (static not dll) with my project? (VC 6.0)
I don't want to insert another project into workspace.
Printable View
How can I link .lib (static not dll) with my project? (VC 6.0)
I don't want to insert another project into workspace.
In the linker settings, you add
- the path to where the library is located (if it's not there already)
- the name of the library to be linked
Tnx,
but can I also do this without changing project settings - in code?
???Code:#pragma comment(lib, "./API/mylib.lib")
If you would like to sacrafice portability, then you may.
Portability? Between different VC versions?Quote:
Originally Posted by Tonto
No, between different platforms.
Now I'm confused...
It works with Win XP, 2K, 98.
Did you mean non-windows platforms?
Likely it won't work for me, and I'm on Windows 98. #pragma is compiler dependant. Someone on a Mac/Linux box definately won't be using VC, and even some Windows users (like me) aren't. (MinGW/gcc)
What's so wrong with putting it in the project options? Besides, what source file would you locate a #pragma in? One or all? If you later want to change that #pragma, you then either have to hunt for one source file, if you're not familiar with the project, or change several. And when linking, it seems it'll be less obvious what's getting linked than if you specify somewhere centralized, like project options or a makefile.
I'm using anyway MFC, so the portability... "is not a problem" :)
I tried to change the link settings, but I'm doing something wrong, because it wont work, linker gives errors (LNK2001 - unresolved external symbol). But it works with #pragma... thats the reason why I use it :)