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

Author Topic: Running SFML with no console without Visual Studio  (Read 2041 times)

0 Members and 1 Guest are viewing this topic.

splavacado100

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Running SFML with no console without Visual Studio
« on: December 10, 2020, 08:59:47 pm »
I realize this question has been asked many times before, and if I was using Visual Studios, the answer would be to link the sfml-main.lib and change the project type to Window. However, I have a different IDE I prefer so I set up the below batch file to build the executable for me.

@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
cl /EHsc source\*.cpp /I "C:\SFML\include" /link C:\SFML\lib\sfml-system.lib C:\SFML\lib\sfml-window.lib C:\SFML\lib\sfml-graphics.lib C:\SFML\lib\sfml-audio.lib C:\SFML\lib\sfml-main.lib /out:PhantomEmber.exe
del *.obj
move PhantomEmber.exe build
pause


The libraries are all the dynamic release versions, with the corresponding dll files in the same directory as the exe, and I made sure to get the correct version of SFML (64bit, for VS 2017 Windows 10). I call the vcvars64.bat to initialize the 64bit MSVC compiler, and then link everything together using the cl command. I am linking the sfml-main.lib, but is there another arguement I need to put in the script that is the equivelent of setting it a Windows project? Or is the only way to get the window with no console is by just building it with Visual Studios? Other than the console, everything compiles and runs fine. Let me know if there is anything about my setup/code thats important.
« Last Edit: December 11, 2020, 03:46:15 am by splavacado100 »

splavacado100

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Running SFML with no console without Visual Studio
« Reply #1 on: December 10, 2020, 09:41:50 pm »
Doing more research regarding Visual Studios compiler, I found the /SUBSYSTEM flag that I can put in my cl command. I'll drop a link if anyway wants to do it the way I am.
https://docs.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem?view=msvc-160

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Running SFML with no console without Visual Studio
« Reply #2 on: December 11, 2020, 08:37:44 am »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything