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

Author Topic: MinGW / SFML 2.1 - Unable to link the executable  (Read 1882 times)

0 Members and 1 Guest are viewing this topic.

BrodyB

  • Newbie
  • *
  • Posts: 2
    • View Profile
MinGW / SFML 2.1 - Unable to link the executable
« on: August 24, 2013, 09:54:52 am »
I wanted to give SFML a go-around and have spent the night going over tutorials on installing everything with MinGW. However, I've been unable to get it to work.
Then I ran the following command in the console: g++ -o SFMLTest main.cpp -lsfml-window -lsfml-graphics

I received the following error:
Quote
C:\Users\Brody\AppData\Local\Temp\ccw9a3vQ.o:main.cpp:(.text+0xe0): undefined re
ference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
collect2: ld returned 1 exit status

I'm using Windows 7.

I'm not setting things up in an IDE like Code::Blocks, but just using Sublime Text for my editing. Am I missing some key steps in the installation process?

Any help is greatly appreciated!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: MinGW / SFML 2.1 - Unable to link the executable
« Reply #1 on: August 24, 2013, 10:23:10 am »
You forgot to link against sfml-system. You'll also make sure to link in the right order: -lsfml-graphics -lsfml-window -lsfml-system
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BrodyB

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: MinGW / SFML 2.1 - Unable to link the executable
« Reply #2 on: August 24, 2013, 05:08:31 pm »
Thanks, eXpl0i3r! That put an end to the error and now it spits out the executable.

However, the program crashes immediately when I start it up. The crash seems to stem from sfml-window-2.dll. I included the built SFML DLLs (sfml-graphics-2.dll, sfml-window-2.dll, etc) into the same folder as the executable so it has access to those things.