SFML game not compiling on Windows

Viewed 251

I've been working on a game using SFML for a while now and it's been going great working on it on my Linux and Mac machines. Recently, I tried compiling the game on Windows and ran into many issues.

I'm using g++ and a makefile.

g++ -std=c++17 -g -O2 -Wall -Wno-reorder -LSFML-2.5.1/lib -ISFML-2.5.1/include -o dungy Animation.o Camera.o Dust.o DustParticle.o Entity.o Game.o main.o Player.o PlayerTrail.o Room.o Textures.o Tile.o -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system

I get tons of undefined references like this when I run make (link to full ouput below):

Animation.o: In function `Animation::Animation(sf::Sprite*, int, bool)':
C:\Users\foxhu\Documents\Programming\C++\dungy/Animation.cpp:9: undefined reference to `__imp__ZNK2sf6Sprite15getGlobalBoundsEv'

C:\Users\foxhu\Documents\Programming\C++\dungy/SFML-2.5.1/include/SFML/Graphics/RectangleShape.hpp:41: undefined reference to `__imp__ZN2sf5ShapeD2Ev'

A similar error is outputted when using Visual Studio [following the SFML website's tutorial exactly] but it's mostly made up of random characters.

Here's a link to the full output including the g++ command

I'm using the newest SFML version and have used g++ in the past to compile a game using almost the exact same makefile, so I'm dumbfounded as to why this isn't working and can find nothing online to help me after hours of looking and trying to solve this issue. The game works perfectly on both Mac and Linux using g++ and the same makefile

One final thing is that the website for SFML says to make sure compiler versions 100% match, I downloaded the one they provided for MinGW 7.3.0 (32-bit) and downloaded the proper SFML version to match that.

Edit:

Here's the full makefile if for some reason it's needed

1 Answers

Apparently, I had to use the debug libraries, which I don't have to use on any other platform.

The makefile I now use has the following flags:

LDFLAGS = -lsfml-graphics-d -lsfml-audio-d -lsfml-window-d -lsfml-system-d

Before, I had these LDFLAGS without the -d on the end.

Not sure why this is different on Windows than Mac or Linux, but it continues my disdain for using Windows when programming.

Related