Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Cant compile sfml on windows
Print
Pages: [
1
]
Author
Topic: Cant compile sfml on windows (Read 2531 times)
0 Members and 1 Guest are viewing this topic.
d4nn97
Newbie
Posts: 6
Cant compile sfml on windows
«
on:
January 12, 2017, 11:02:14 pm »
I have attached a picture of the error that I get.
«
Last Edit: January 13, 2017, 05:57:44 am by d4nn97
»
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
SFML compile c++
«
Reply #1 on:
January 12, 2017, 11:37:58 pm »
Because copy pasting the error was so much harder?
If you link sfml-main you need to use the windows subsystem by adding the -mwindows flag.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
d4nn97
Newbie
Posts: 6
Re: SFML compile c++
«
Reply #2 on:
January 12, 2017, 11:45:37 pm »
Hi, I tried to add the flag but it still produces the same error
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: SFML compile c++
«
Reply #3 on:
January 13, 2017, 12:10:41 am »
Also, don't create unnecessary polls. There's a big blue "NEW TOPIC" button for creating a new thread.
Where did you add the flag?
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
d4nn97
Newbie
Posts: 6
Re: SFML compile c++
«
Reply #4 on:
January 13, 2017, 12:13:59 am »
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics -lsfml-window -lsfml-system -mwindows
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: SFML compile c++
«
Reply #5 on:
January 13, 2017, 12:40:14 am »
So you removed sfml-main now?
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
d4nn97
Newbie
Posts: 6
Re: SFML compile c++
«
Reply #6 on:
January 13, 2017, 12:43:02 am »
gcc -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics -lsfml-window -lsfml-system -lsfml-main -mwindows
Logged
d4nn97
Newbie
Posts: 6
Cant compile sfml on windows
«
Reply #7 on:
January 13, 2017, 05:56:28 am »
g++ -IC:\SFML\include -c main.cpp -o main.o
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics -lsfml-window -lsfml-system -lsfml-main -mwindows
I have compiled and tried to execute the program in this way but i get the following error
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: Cant compile sfml on windows
«
Reply #8 on:
January 13, 2017, 11:14:46 am »
Please don't create multiple topics...
You're using the -o flag twice when linking. The -o flag is for the output file and not for the object file, so you need to just provide the object file without -o flag.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
d4nn97
Newbie
Posts: 6
Re: Cant compile sfml on windows
«
Reply #9 on:
January 13, 2017, 05:49:12 pm »
Ok thank you. I was trying to move this to a better place thinking i could delete or move my previous post.
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Cant compile sfml on windows