mingw cross-compile SFML for windows

Hello all

So I am trying to compile an SFML program for windows (using mingw) and I am getting the error

fatal error: SFML/Graphics.hpp: No such file or directory


Thanks you.

EDIT:

cross-compiling from Linux
Last edited on
Check the include path for the compiler. The directory where the file is must be included in it. I think on most compilers you do that by passing the command line parameter

 
mingw -I[path] main.cpp

as in

 
mingw -IC:\include main.cpp

Never used mingw though.
err... I am compiling in Linux. Sorry for not mentioning

here is my Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Compiler
CC   = i686-w64-mingw32-g++
OPTS = -g -std=c++0x

# Project name
PROJECT = foo

# Libraries
LIBS = -lsfml-graphics -lsfml-window -lsfml-network -lsfml-system

# Client Files and folders
SRCS = $(shell find src/ -name '*.cpp')
DIRS = $(shell find src/ -type d | sed 's/src/./g' ) 
OBJS = $(patsubst src/%.cpp,obj/%.o,$(SRCS))

# Targets
$(PROJECT): buildrepo $(OBJS)
	$(CC) $(OBJS) $(LIBS) -o $@

obj/%.o: src/%.cpp
	$(CC) $(OPTS) -c $< -o $@

clean:
	rm $(PROJECT) obj -Rf

buildrepo:
	mkdir -p obj
	for dir in $(DIRS); do mkdir -p obj/$$dir; done
Update:

I added "-I/usr/local/include/" to the OPTS variable, now I don't get that message.. but I do get this

/usr/bin/i686-w64-mingw32-ld: cannot find -lsfml-system
/usr/bin/i686-w64-mingw32-ld: cannot find -lsfml-window
/usr/bin/i686-w64-mingw32-ld: cannot find -lsfml-graphics
collect2: ld returned 1 exit status
Did you copy all of SFML's static library (.a/.lib) files into the directory where your compiler is trying to find them? The directory probably looks something like "C:/mingw/lib/", or wherever you have mingw installed.
It's the same thing with libraries. You can add paths where the compiler will search for your libraries using -L (-L/usr/local/lib).
Alright, I changed the LIBS variable as so
LIBS = -L/usr/local/lib/ -lsfml-system -lsfml-window -lsfml-graphics
But still get the error messages "cannot find..."
*BUMP* it would be nice to have this done by thursday
Where on your hard drive are the libraries sfml-system, sfml-window and sfml-graphics?
/usr/local/lib/
I know it's perhaps a silly question but are they actually named "libsfml-system.a" etc in the lib directory?
Topic archived. No new replies allowed.