static lib
Hello. I have created a project that consists of several header and source files. I want to create a static library out of those files that are used in the project. How can I do that? (VC++ 2008 EE)
Here's an article: Visual C++ Walkthrough: Creating and Using a Static Library
The core point: instead of making an .exe, you alter the project properties so that it builds a .lib. Then you link against that library in the .exe project.
The core point: instead of making an .exe, you alter the project properties so that it builds a .lib. Then you link against that library in the .exe project.
This is probably because you are trying to debug the program, how are you building? If you a just hitting F5 then this will be why, you can use F7 to build without debugging.
Quote:Original post by _moagstar_
This is probably because you are trying to debug the program, how are you building? If you a just hitting F5 then this will be why, you can use F7 to build without debugging.
Yeah I was doing that, Thanks :)
Does the file that includes "main" have to be included?
Quote:Original post by sheep19
Does the file that includes "main" have to be included?
No, a static lib doesn't have an entry point so you don't need to include that file for compilation. HTH
Thanks for the help!
I have another question. My library uses SDL and boost. Will I have to include SDL and boost to use my .lib? Or everything will be built in the .lib file?
EDIT:
Ok I created the .lib file. Its size is 5116 KB :|
I also created a new project, put the lib file in the linker's input and tried to compile. I get:
1>------ Build started: Project: Reach The Summit!, Configuration: Release Win32 ------
1>Linking...
1>MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
1>G:\Minas\Documents\Visual Studio 2008\Projects\Reach The Summit!\Release\Reach The Summit!.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://g:\Minas\Documents\Visual Studio 2008\Projects\Reach The Summit!\Reach The Summit!\Release\BuildLog.htm"
1>Reach The Summit! - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's wrong?
That's the code by the way:
[Edited by - sheep19 on June 22, 2009 9:23:44 AM]
I have another question. My library uses SDL and boost. Will I have to include SDL and boost to use my .lib? Or everything will be built in the .lib file?
EDIT:
Ok I created the .lib file. Its size is 5116 KB :|
I also created a new project, put the lib file in the linker's input and tried to compile. I get:
1>------ Build started: Project: Reach The Summit!, Configuration: Release Win32 ------
1>Linking...
1>MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
1>G:\Minas\Documents\Visual Studio 2008\Projects\Reach The Summit!\Release\Reach The Summit!.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://g:\Minas\Documents\Visual Studio 2008\Projects\Reach The Summit!\Reach The Summit!\Release\BuildLog.htm"
1>Reach The Summit! - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's wrong?
That's the code by the way:
#include "Min_SpriteLib.h"int main(int argc, char *args[]){ return 0;}
[Edited by - sheep19 on June 22, 2009 9:23:44 AM]
Quote:Original post by sheep19
I have another question. My library uses SDL and boost. Will I have to include SDL and boost to use my .lib? Or everything will be built in the .lib file?
I would leave it so that any exe that links with your .lib also has to link with sdl and the boost libs you are using.
Quote:Original post by sheep19
What's wrong?
Looks like you're trying to build a Win32 application, is this definately the correct setting? Or should you be building a console application? If you are building a Win32 application, then your main function should be a WinMain function.
Quote:Original post by _moagstar_Quote:Original post by sheep19
I have another question. My library uses SDL and boost. Will I have to include SDL and boost to use my .lib? Or everything will be built in the .lib file?
I would leave it so that any exe that links with your .lib also has to link with sdl and the boost libs you are using.
How can I leave it the way you are suggesting? (or maybe the programmer who uses it only have to include SDL and not boost)
Is there a way to choose when I build the library if it is going to be a console or a windows app?
[Edited by - sheep19 on June 22, 2009 1:28:01 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement