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

Author Topic: Missing references - Windows 10 - MinGW 5.1  (Read 2850 times)

0 Members and 2 Guests are viewing this topic.

niasie

  • Newbie
  • *
  • Posts: 3
    • View Profile
Missing references - Windows 10 - MinGW 5.1
« on: August 07, 2015, 01:37:06 am »
Hey guys,
so I recently upgraded from Windows 7 to Windows 10 and basically, everything SFML related just broke. Today I set up MinGW 5.1 SJLJ and built SFML 2.3.1 statically in debug mode with it - no problems whatsoever. After that, I tried to compile the standard SFML example and the first step went fine:
g++ -c testProject.cpp  -DSFML_STATIC -ID:\Programme\SFML-2.3.1-GCC5.1-S-D\include -o testProject.o

However, the second step miserably failed:
g++ testProject.o -o  testProject.exe -LD:\Programme\SFML-2.3.1-GCC5.1-S-D\lib -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d

This is the output:
(click to show/hide)

The vast majority of the errors are related to OpenGL references missing, as you can tell by the names, but at the end a few other ones, including Joystick and JPEG problems, occur. As I built SFML statically, they should be included with the .a files in the lib folder, shouldn't they? Also, for some reason g++.exe crashes when I build SFML projects from Eclipse, but it's fine from the command line. Weird.
Would be great, if someone had a bit of advice for me.  :)

Niall
« Last Edit: August 07, 2015, 01:38:43 am by niasie »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11028
    • View Profile
    • development blog
    • Email
Re: Missing references - Windows 10 - MinGW 5.1
« Reply #1 on: August 07, 2015, 01:45:53 am »
Well reading the tutorial or the FAQ on static linking might turn out to be enlightening. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

niasie

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Missing references - Windows 10 - MinGW 5.1
« Reply #2 on: August 07, 2015, 02:14:59 am »
Ohh... this is actually my first time using 2.3, so I didn't realise you will now have to link the dependencies aswell. Thanks for the help! :) I however still have a question, and this might be dumb, sorry: The FAQ states that the extlibs folder includes all dependencies for Windows, but I can't seem to find winmm, for example. When I try to compile with:
g++ -o  testProject.exe -LD:\Programme\SFML-2.3.1-GCC5.1-S-D\lib -lsfml-graphics-s-d -lopengl32 -lfreetype -ljpeg -lsfml-window-s-d -lwinmm -lgdi32 -lsfml-system-s-d
I get this error:
D:/Programme/mingw-w64/x86_64-5.1.0-posix-sjlj-rt_v4-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x25): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
This could either indicate that I did something wrong, or that the information in the FAQ is actually wrong and you have to get some of the dependencies yourself. I'm betting on assumption one :D

Niall

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11028
    • View Profile
    • development blog
    • Email
AW: Missing references - Windows 10 - MinGW 5.1
« Reply #3 on: August 07, 2015, 08:23:05 am »
System libraries such as winmm or gdi32 are not included in SFML because they come either with your OS or your toolchain.

As for the error, did you set thd subsystem to window instead of console (flag -mwindow), if so you'll need to link against sfml-main.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

niasie

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Missing references - Windows 10 - MinGW 5.1
« Reply #4 on: August 07, 2015, 03:52:28 pm »
Okay, wow, this was a REALLY dumb mistake on my side: I forgot to specify the input object file at the second step. :D Anyways, thank you for your help eXpl0it3r, everything is now working fine. I'll also try to remember to read the changelog of new versions of SFML before blindlessly installing them ;)
Have a nice day!