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

Author Topic: Compiled SFML code runs nothing  (Read 1188 times)

0 Members and 1 Guest are viewing this topic.

easys

  • Newbie
  • *
  • Posts: 2
    • View Profile
Compiled SFML code runs nothing
« on: October 03, 2023, 09:12:56 am »
I'm new to sfml and was trying to get the example code to run in windows on visual studio code. I have a project with just a main cpp file with the example code in it and all the dlls. I ran g++ -c main.cpp -I(Path to the include folder) and then g++ main.o -o main -L(Path to the lib folder) -lsfml-graphics -lsfml-window -lsfml-system. This all runs fine without error but when I go to run the executable nothing happens it just immediately exits. If I add a print statement to the start of the code still nothing. My compiler is mingw-64 and it has worked fine and I haven't had an issue so I'm not sure where to look.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Compiled SFML code runs nothing
« Reply #1 on: October 03, 2023, 11:28:29 am »
When you say "the example code", what code are you referring to?

I can also recommend to use the CMake extension in VSC and use the SFML CMake Template: https://github.com/SFML/cmake-sfml-project
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

easys

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Compiled SFML code runs nothing
« Reply #2 on: October 04, 2023, 04:36:37 am »
I tried running the github template but I got this error
build] collect2.exe: error: ld returned 1 exit status[build] make.exe[2]: *** [bin/sfml-graphics-d-2.dll] Error 1[build] make.exe[1]: *** [_deps/sfml-build/src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2[build] make.exe: *** [all] Error 2

Thrasher

  • SFML Team
  • Jr. Member
  • *****
  • Posts: 57
    • View Profile
Re: Compiled SFML code runs nothing
« Reply #3 on: October 04, 2023, 08:13:38 am »
You'll need to share more of the error to know what the actual problem is.

 

anything