Quote:Original post by sheep19
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:
*** Source Snippet Removed ***
Two things:
1) The code snippet you showed uses a main() function. If you're creating a Windows application, you'll need a WinMain() function. Your linker is complaining because it's expecting WinMain() for some reason, and it's not finding it. This could be because your project is set up as a Windows application, or because SDL requires WinMain(). In either case, switching main() to WinMain() should fix the problem. (Note: WinMain() requires different arguments than main(); its signature looks like int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR, int). Look up a quick Windows programming tutorial for more info.)
2) If you want, you can link your static library against all libraries necessary to use it. I think what happens in this case is that the linked libraries get "rolled in" with your new library. The end result is that users of your library won't have to link against all of the libraries it depends on; they can just link against yours, since it already includes the others. They'll still need to be able to find all your #include-ed files, though.