SFML community forums

Help => Window => Topic started by: Jeff8500 on August 02, 2009, 10:12:45 pm

Title: Issue with linking to main library
Post by: Jeff8500 on August 02, 2009, 10:12:45 pm
I'm having trouble linking to the SFML main static library in VC2008. I have tried linking to both sfml-main.lib and sfml-main-d.lib, and to my dismay, they do not appear to be overriding WinMain. I also thought maybe I should try including SFML_Main.cpp after linking to the main library, but that didn't work, either (I didn't really expect it to, though).  The window package tutorial says that you should link to the static SFML_Main library, but it would appear that there is no sfml-main-s-d.lib in the VC2008 build. Anyone know where I went wrong?
Title: Issue with linking to main library
Post by: Laurent on August 02, 2009, 10:24:13 pm
There's no sfml-main dynamic library, so sfml-main-d.lib is the static one.

Linking to sfml-main works, you should give more informations about what you did exactly if it doewn't work for you.
Title: Issue with linking to main library
Post by: Jeff8500 on August 02, 2009, 10:40:06 pm
All I did was add sfml-main-d.lib to "Additional dependencies" under "Linker -> input". Then, when I compiled and ran the program, it behaved exactly as it had before I linked to it.
Title: Issue with linking to main library
Post by: Laurent on August 02, 2009, 11:41:58 pm
Quote
Then, when I compiled and ran the program, it behaved exactly as it had before I linked to it.

What do you mean? sfml-main is not supposed to change anything to your program's behaviour, it just changes the entry point to main() in a Win32 GUI application.
Title: Issue with linking to main library
Post by: Jeff8500 on August 03, 2009, 06:25:31 am
Sorry, I explained that poorly, I meant that main() never starts (I have it set to return instantly, and all I get is a big white window stuck there until I manually close the program).
Title: Issue with linking to main library
Post by: Laurent on August 03, 2009, 07:52:07 am
Can you show your code?
Title: Issue with linking to main library
Post by: Jeff8500 on August 03, 2009, 06:31:42 pm
Code: [Select]

int main()
{
   return 1;
}


Either way, I believe I found the problem. When I was making my new project, I forgot to check the "Empty Project" box, and VC2008's precompiled headers seem to prevent sfml-main.lib from doing anything. I'm pretty sure this is the issue, because in the two test projects I made, both just returned, and one had precompiled headers with the other did not. Thanks for the help!