Xander!

I hope i am correct in saying you are the same person who is SFML coder? if you are Thanks alot for the SFML 2.0 setup tutorial,

More importantly and out of curiosity why do you not include sfml-main-d.lib in your linking?
Hi. I am confirming that I, Xander314, am SFMLCoder. (Note the number 314 as this site has a few other Xanders). I may also go by the name of Xephyr from time to time, though it's already taken on many sites.

More importantly and out of curiosity why do you not include sfml-main-d.lib in your linking?

All the other libraries are either static libraries, or import libraries to provide access to DLLs, for SFML window, system, graphics, audio and networking functionality.

sfml-main.lib (release build) and sfml-main-d.lib (debug build) are somewhat different. They are both static libraries (no dynamic/import library versions).

As for what they do? I shall try and explain now. My explanation may seem off topic at first, but bear with me ;)

As you probably know, the entry point for a C++ console application is int main(int, char*[]). But what if you don't want the console window with your application. Then you make it a windowed application. As I understand it, the entry point for windowed applications on Unix operating systems (Mac, Linux, ...) is still int main().

However, the entry point for a windowed application on Windows is int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT). So if you want an SFML application with no console window on Windows, you must use this entry point. But then your code is not very portable - it will no longer compile for Unix as it has a WinAPI specific entry point.

The solution is sfml-main.lib and sfml-main-d.lib. Basically, it's code is very simple. If you compile it on Windows, it creates the Windows entry point int WINAPI WinMain(...), and calls the console entry point int main(...) from it. On Unix, it contains no code at all.

Thus by linking to this static library, you can always use the int main(...) entry point, and if you are making a windowed application on Windows, sfml-main.lib ensures that the linker can find the correct entry point.

I hope this helps you understand the purpose of sfml-main-d.lib. As for why I don't link to it, it's because I always use the console entry point. However, I am meaning to rerecord my SFML setup videos on my YouTube channel, to include information about this.

-SFMLCoder
http://sfmlcoder.wordpress.com/
http://www.twitter.com/Xander_314/
http://www.youtube.com/SFMLCoder/
http://on.fb.me/oetKbT

Last edited on
Great to hear from you Xander, Regardless your youtube videos are much better than the onsite tutorial SFML has and it worked for me pretty much first try. Thanks alot for having them. I Do unfortunetly still have trouble compiling even some of the basic SFML tutorial programs, though i think that maybe because the tutorials use 1.6

EDIT: Also i found their post about the changes from 1.6 - 2.0 and i think you should probably link to it on your 2.0 videos :)

http://www.sfml-dev.org/forum/viewtopic.php?p=35091#35091
Last edited on
Thanks :) I'll add the link to the newest set of videos and also post about it on my blog.
As doubtful as I ever am to youtube/video tutorials, this was very useful, and I have Xander to thank for finally getting SFML up and running properly :)
Topic archived. No new replies allowed.