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

Author Topic: libsfml-main linked and compiling but entry point is still command line  (Read 1498 times)

0 Members and 1 Guest are viewing this topic.

pedromipigo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hey guys ;)

So, my name is Pedro and I am a portuguese developer. I love SFML because of its simplicity and ease of use for game development purposes (I used to develop games in XNA until Microsoft discontinued it and then I moved to HTML5 and JavaScript gaming but it is not as good as C++ in terms of performance). This is my first post in the forum and it starts with a simple problem...

I use MinGW as my toolchain for C++ and Sublime Text as my code editor. I have been reading the official SFML Game Development book and everything works smoothly. The program compiles into object files and then links with the required libraries through a Makefile but when I run the compiled game, a command prompt window opens. I do not mind that at all but I have read on some posts that sfml-main can be linked to the compiled game because of the entry point but it still opens the command prompt first and then the game window.

I am using GCC 4.8.1 with SFML 2.1.

Is it normal to open up like that or is there something that I am missing?

Thanks in advance and best regards,
Pedro ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: libsfml-main linked and compiling but entry point is still command line
« Reply #1 on: August 07, 2014, 08:53:41 pm »
sfml-main doesn't hide the console, it just changes the entry point from WinMain to main when you have a "Win32 application" project. So what you need to do is to switch your application to this type. I'm not sure but if I remember correctly, with MinGW you must add the "-mwindows" linker option.
Laurent Gomila - SFML developer

pedromipigo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: libsfml-main linked and compiling but entry point is still command line
« Reply #2 on: August 07, 2014, 09:06:03 pm »
Merci Laurent, that solved the problem :D

But is that like a Windows-only flag, or can I keep it afterwards if I want to compile the game to other platforms?

Best regards,
Pedro ;)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: libsfml-main linked and compiling but entry point is still command line
« Reply #3 on: August 07, 2014, 09:42:45 pm »
WinMain() and thus sfml-main transforming that to a standard main() entry point as well as -mwindows is all Windows specific stuff.
« Last Edit: August 08, 2014, 12:39:41 am by Jesper Juhl »

pedromipigo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: libsfml-main linked and compiling but entry point is still command line
« Reply #4 on: August 07, 2014, 10:07:48 pm »
Thanks Jesper, I will comment that flag in my Makefile so that I can remember later :)

Best regards,
Pedro ;)