Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Issue with linking to main library  (Read 6751 times)

0 Members and 1 Guest are viewing this topic.

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issue with linking to main library
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Issue with linking to main library
« Reply #1 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.
Laurent Gomila - SFML developer

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issue with linking to main library
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Issue with linking to main library
« Reply #3 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.
Laurent Gomila - SFML developer

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issue with linking to main library
« Reply #4 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).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Issue with linking to main library
« Reply #5 on: August 03, 2009, 07:52:07 am »
Can you show your code?
Laurent Gomila - SFML developer

Jeff8500

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issue with linking to main library
« Reply #6 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!