Git Product home page Git Product logo

Comments (22)

kuroni avatar kuroni commented on September 4, 2024

Can you reply your full Makefile?

Also, remember to put the correct version of SFML. I uses mingw32 64bit, so I used the GCC 7.3.0 MinGW (SEH) - 64-bit version of SFML.

This is what happen when I use the 32-bit library on the 64-bit compiler:

x86_64-w64-mingw32-g++ -o bin/bongo.exe obj/data.o obj/mania.o obj/jsoncpp.o obj/ctb.o obj/taiko.o obj/main.o obj/osu.o ico/ico.res -DSFML_STATIC -I/home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/include -Iinclude -L/home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib -std=c++17 -s -O2 -mwindows -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-graphics-s.a when searching for -lsfml-graphics-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-graphics-s.a when searching for -lsfml-graphics-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-graphics-s.a when searching for -lsfml-graphics-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lsfml-graphics-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-window-s.a when searching for -lsfml-window-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-window-s.a when searching for -lsfml-window-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-window-s.a when searching for -lsfml-window-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lsfml-window-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-system-s.a when searching for -lsfml-system-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-system-s.a when searching for -lsfml-system-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libsfml-system-s.a when searching for -lsfml-system-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lsfml-system-s
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libfreetype.a when searching for -lfreetype
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libfreetype.a when searching for -lfreetype
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /home/kuroni/Documents/Repositories/external_lib/SFML-2.5.1-32bit/lib/libfreetype.a when searching for -lfreetype
/usr/lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lfreetype
collect2: error: ld returned 1 exit status
make: *** [Makefile:18: bin/bongo.exe] Error 1

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024
SRCDIR := src
OBJDIR := obj
ICODIR := ico
SRC := $(wildcard $(SRCDIR)/*.cpp)
OBJ := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRC))
ICO := $(ICODIR)/ico.res
CXXFLAGS := -std=c++17 -s -O2 -mwindows
LDFLAGS := -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
INCFLAGS := -I/C:/Users/me/Documents/MEGA/Coding/SFML/include/ -Iinclude
LIBFLAGS := -L/C:/Users/me/Documents/MEGA/Coding/SFML/lib/
DEFINES := -DSFML_STATIC

.PHONY: test clean

bin/bongo.exe: $(OBJ) $(ICO)
	$(CXX) -o $@ $^ $(DEFINES) $(INCFLAGS) $(LIBFLAGS) $(CXXFLAGS) $(LDFLAGS)

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
	$(CXX) -c -o $@ $^ $(DEFINES) $(INCFLAGS) $(LIBFLAGS) $(CXXFLAGS) $(LDFLAGS)

$(ICODIR)/ico.res: $(ICODIR)/ico.rc
	windres -O coff -o $@ $^

test:
	bin/bongo.exe

clean:
	rm $(OBJ)

I didn't really change anything except the inc and lib flags

and I'm pretty sure I downloaded SFML 2.5.1 (GCC 7.3.0 MinGW (SEH) - 64-bit) and clicked on the link to download the matching MinGW version on the SFML download page

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

Your Makefile seems quite like mine to be honest.

Can you try make clean to remove all object files and make again? Does it still happen?

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

Yeah the same thing happens

Btw, within the MinGW 7.3.0 .zip (that I'm told to use on the SFML download page) there's 2 versions of g++ and gcc. Normal g++.exe and gcc.exe, and x86_64-w64-mingw32-g++.exe and x86_64-w64-mingw32-gcc.exe. What's the difference?

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

I just realized there is g++ and x86_64-w64-mingw32-g++ hm. Sorry I am not really in touch with this topic, I developed using mingw32 on Linux :p

On the topic, can you please add the line CXX := x86_64-w64-mingw32-g++ to the top of the Makefile, then run make clean and make again?

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

btw running make clean returns this

rm  obj/osu.o  obj/main.o  obj/taiko.o  obj/ctb.o  obj/jsoncpp.o  obj/mania.o  obj/data.o
process_begin: CreateProcess(NULL, rm obj/osu.o obj/main.o obj/taiko.o obj/ctb.o obj/jsoncpp.o obj/mania.o obj/data.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:29: clean] Error 2

Now I'm getting

x86_64-w64-mingw32-g++ -c -o obj/osu.o src/osu.cpp -DSFML_STATIC -I/C:/Users/me/Documents/MEGA/Coding/SFML/include/ -Iinclude -L/C:/Users/me/Documents/MEGA/Coding/SFML/lib/ -std=c++17 -s -O2 -mwindows -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
In file included from src/osu.cpp:1:0:
include/header.hpp:15:10: fatal error: SFML/Graphics.hpp: No such file or directory
 #include <SFML/Graphics.hpp>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:20: obj/osu.o] Error 1

I suppose I could create a linux VM

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

That is very weird that it couldn't find the files.

Linux VM is not recommended though, installing mingw32 on Linux is a pain. Maybe try switching to 32-bit versions of the library and compiler and see if they work?

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

Oh and, revert the Makefile change I said and try mingw32-make instead of make.

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

oh I've symlinked make to mingw32-make, and I just went ahead and manually removed the obj folder and remade it

I guess I could try the 32 bit versions

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

Using 32 bit versions of MinGW and SFML still results in this

g++ -c -o obj/osu.o src/osu.cpp -DSFML_STATIC -I/C:/Users/fruit/Documents/MEGA/Coding/SFML-32bit/include/ -Iinclude -L/C:/Users/fruit/Documents/MEGA/Coding/SFML-32bit/lib/ -std=c++17 -s -O2 -mwindows -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
In file included from src/osu.cpp:1:0:
include/header.hpp:15:10: fatal error: SFML/Graphics.hpp: No such file or directory
 #include <SFML/Graphics.hpp>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:19: obj/osu.o] Error 1

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

Okay that's weird. I will look into this later since I am travelling :)

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

ok thanks

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

I can't seem to find any problem from my side :( Try looking into your SFML path again if there is any errors.

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

Nope there's nothing wrong with the path itself, so I'm not quite sure what's happening

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

Really? The last time I had that error I didn't realize there was a SFML folder nested inside the uncompressed folder.

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

Nope, my SFML folder directly contains bin and include

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

I don't know what is happening to be honest. Try other SFML libraries and/or forums then :( I don't think the problem is project-specific. If you find anything please comment here.

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

I think I finally realized what is happening.

Try to use the Code::Blocks version for 32-bit if that's what your computer is on. I played around with the libraries for a while I ran into similar issue when I tried to compile my code earlier. Hope this helps :)

from bongocat-osu.

raymondwzeng avatar raymondwzeng commented on September 4, 2024

Apologies for the necro, but I found a solution after fiddling around for over 3 hours. I tried pretty much everything under the sun, but the final solution was this:

Download mingw32 7.3.0 (The 32 bit version) from the SFML website.
Download SFML 2.5.1 for GCC Windows 32 Bit 7.3.0 (Should be the bottom left)
Move mingw32 folder to base C:
Move SFML "include" folder into mingw32\include, and the "lib" folder into mingw32\bin\lib

Inside the Makefile:

OBJDIR := obj
ICODIR := ico
SRC := $(wildcard $(SRCDIR)/*.cpp)
OBJ := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRC))
ICO := $(ICODIR)/ico.res
CXXFLAGS := -std=c++17 -s -O2 -mwindows
LDFLAGS := -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
INCFLAGS := -IC:/mingw32/include -Iinclude
LIBFLAGS := -LC:/mingw32/bin/lib
DEFINES := -DSFML_STATIC

.PHONY: test clean

bin/bongo.exe: $(OBJ) $(ICO)
	$(CXX) -o $@ $^ $(DEFINES) $(INCFLAGS) $(LIBFLAGS) $(CXXFLAGS) $(LDFLAGS)

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
	$(CXX) -c -o $@ $^ $(DEFINES) $(INCFLAGS) $(LIBFLAGS) $(CXXFLAGS) $(LDFLAGS)

$(ICODIR)/ico.res: $(ICODIR)/ico.rc
	windres -O coff -o $@ $^

test:
	bin/bongo.exe

clean:
	rm $(OBJ)

Nothing was modified, except for the folders. You see the lack of a \ or / between the -L and the file path? That alone took me 2 HOURS to figure out.

The end result: The application builds successfully, although it errors from a missing png if you run it straight from the bin.

I hope this helps someone should they run into the error, and avoid losing so much time as I have.

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

I'll check it out tomorrow, thanks

from bongocat-osu.

kuroni avatar kuroni commented on September 4, 2024

@MacAndSwiss Thank you for this! I have always been developing this on Linux so I forgot the fact that the root of Windows does not have the /.

Plus, you mentioned that it errors a missing png. Is it an issue? If possible, you can make an issue report for me.

from bongocat-osu.

exKitsune avatar exKitsune commented on September 4, 2024

So I simply removed the / behind the C: on my makefile from above, and it just works
I can't believe it was that simple, thanks MacAndSwiss

from bongocat-osu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.