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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Sander777

Pages: [1]
1
General / SFML static linking
« on: July 11, 2019, 01:12:01 pm »
I have such C++ code
#include <iostream>
#include "SFML/Window.hpp"

#define SFML_STATIC

int main() {
        sf::Window window(sf::VideoMode(800, 600), "test");
}
 

And such Makefile
CC                              := g++
DEBUG_FLAGS     := -mwindows
RELEASE_FLAGS   := -s -O3 -w -mwindows

BIN             := bin
SRC             := src
INCLUDE := -Iinclude
LIB             := -Llib

LIBRARIES := -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32

EXECUTABLE      := main.exe

all: $(SRC)/*
        $(CC) $(DEBUG_FLAGS) $(INCLUDE) $(LIB) $(LIBRARIES) $^ -o $(BIN)/$(EXECUTABLE)

release: $(SRC)/*
        $(CC) $(RELEASE_FLAGS) $(INCLUDE) $(LIB) $(LIBRARIES) $^ -o $(BIN)/$(EXECUTABLE)

clean:
        $(RM) $(BIN)/$(EXECUTABLE)

run:
        ./$(BIN)/$(EXECUTABLE)
 

But I can't compile and I am geting such error
g++ -mwindows -Iinclude -Llib -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 src/main.cpp -o bin/main.exe
d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\CyberOni\AppData\Local\Temp\ccLj2xOO.o:main.cpp:(.text+0x7c): undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\CyberOni\AppData\Local\Temp\ccLj2xOO.o:main.cpp:(.text+0xa2): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\CyberOni\AppData\Local\Temp\ccLj2xOO.o:main.cpp:(.text+0xdb): undefined reference to `_imp___ZN2sf6WindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\CyberOni\AppData\Local\Temp\ccLj2xOO.o:main.cpp:(.text+0xfe): undefined reference to `_imp___ZN2sf6WindowD1Ev'
collect2.exe: error: ld returned 1 exit status
Makefile:15: recipe for target 'all' failed
make: *** [all] Error 1
 

Pages: [1]