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

Author Topic: Using VSC + gcc for my CSFML Project  (Read 2889 times)

0 Members and 1 Guest are viewing this topic.

bowie

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Using VSC + gcc for my CSFML Project
« on: December 26, 2023, 08:16:40 am »
Hi,
I need to use VSC + gcc (Mingw on a Windoes System) for my CSFML-Project.
I have installed MSYS2 on my Windows 11 PC and have dowloaded CSFML 2.5.1 Visual C++ / GCC - 64-bit.

Running gcc after having configured everthing in tasks.json

gcc is envoked like this:
gcc.exe -fdiagnostics-color=always
-o C:\Users\mboum\Documents\GitHub\breakout\breakout.exe
-IC:\Users\mboum\Documents\GitHub\breakout\CSFML\include\
-LC:\Users\mboum\Documents\GitHub\breakout\CSFML\lib\gcc\
-lcsfml-graphics -lcsfml-system -lcsfml-window -lcsfml-network -lcsfml-audio
I get the following error message:
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function `main':
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
 
Any idea where I am wrong?

Regs Marcus
« Last Edit: December 26, 2023, 09:06:14 am by bowie »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10930
    • View Profile
    • development blog
    • Email
Re: Using VSC + gcc for my CSFML Project
« Reply #1 on: December 30, 2023, 12:35:27 pm »
Any reason you're using CSFML instead of SFML?

The linking order is not fully correct, csfml-system should come at the end.
Not sure if that's a "feature" of the msys2 provided compiler, but it looks like it's looking for WinMain instead of just main. You may want to check if there's a way to disable that behavior in the libmingw32 library.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything