Compiling SFML on Windows

Hello

I need to compile a SFML program on Windows using Cygwin.
But for some reason, this ain't working.

My G++ (Cygwin) command:
g++ test.cpp -o test.exe -L "C:/Documents and Settings/Administrator/Desktop/SFML-2.3/include/SFML/" -lsfml-system-s -lsfml-window-s -lsfml-graphics-s -std=c++11

Error:
test.cpp:60:27: fatal error: SFML/Window.hpp: No such file or directory
#include <SFML/Window.hpp>
^
compilation terminated.



Why isn't this working?

Thanks for reading,
Niely
Last edited on
First things first, unless you're compiling on an XP machine your path is wrong. If you copy and pasted this from a tutorial then it is probably an older one.

After that part is out of the way, you need to tell g++.exe to include the path where your header files are located. This is done with the -B option as stated in the man page for this application.
^I am compiling on a XP machine.
And I replaced -L with -B, and that still ain't working.
Try removing "SFML/" after the "/include/" in your argument to -B. I'm looking at the SFML folder structure right now and with the way you are including that header, you are telling it to look for ".../SFML-2.3/include/SFML/SFML/Window.hpp" in which case the compiler is correct, that won't exist.
Last edited on
Thanks!
That's working, but now I'm getting this error:
#error This UNIX operating system is not supported by SFML library
http://www.sfml-dev.org/documentation/2.2/Config_8hpp_source.php

Why isn't SFML detecting I'm using Windows?
To be honest, I'm not sure. I can tell you that you're getting that error because something that is supposed to be defining the '_WIN32' preprocesser is defining '__unix__' but none of the other macros on Lines 71 - 94. I'm trying to dig up where the compiler might be seeing __unix__.
When you called cmake to generate the Makefile, which generator option(s) did you use?
^I guess I didn't used Cmake at all. Just G++.
The reason _WIN32 is not defined is probably because you use Cygwin. I have never used it myself so I'm not sure but from my understanding Cygwin tries to emulate a POSIX/Unix-like enviroment so I guess that's why it defines the __unix__ macro.

I'm afraid I don't know how to solve the problem. A quick search seems to suggest it's not that easy. It's probably easier to get it to work using something like MinGW instead of Cygwin.
Last edited on
^Thanks, I used something else as Cygwin, and I don't get the Unix-error anymore. But MinGW and Cygnus also ain't working. They gave errors that specific files (SFML) ain't found etc.
Topic archived. No new replies allowed.