Jump to content
  • Advertisement
Sign in to follow this  
sheep19

static lib

This topic is 3308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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:
#include "Min_SpriteLib.h"

int main(int argc, char *args[])
{
return 0;
}


[Edited by - sheep19 on June 22, 2009 9:23:44 AM]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!