I'm trying to get SFML going on Windows 8 in CodeBlocks. I thought I had everything going nicely, but the test code is spitting fire at me when I try to build. It's certainly an improvement from it complaining about the namespace when I didn't specify a file extension so it defaulted to .c, but now it's complaining about Time.hpp and Export.hpp from System.
It's detected MinGW nicely, and the "GNU GCC Compiler" is my selected and default compiler and has the right path.
Any clue what's going wrong?
mingw32-g++.exe -IC:\SFML-2.1\include -c "D:\Chris\My Documents\SFML Test\main.cpp" -o "D:\Chris\My Documents\SFML Test\main.o"
In file included from C:\SFML-2.1\include/SFML/System.hpp:32:0,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/Config.hpp:1:1: error: 'include' does not name a type
include <SFML/Graphics.hpp>
^
In file included from C:\SFML-2.1\include/SFML/System/Export.hpp:31:0,
from C:\SFML-2.1\include/SFML/System/Clock.hpp:31,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/Config.hpp:1:1: error: 'include' does not name a type
include <SFML/Graphics.hpp>
^
In file included from C:\SFML-2.1\include/SFML/System/Clock.hpp:32:0,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/System/Time.hpp:40:23: error: variable 'sf::SFML_API_IMPORT sf::Time' has initializer but incomplete type
class SFML_SYSTEM_API Time
^
C:\SFML-2.1\include/SFML/System/Time.hpp:40:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected primary-expression before 'public'
public :
^
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected '}' before 'public'
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected ',' or ';' before 'public'
C:\SFML-2.1\include/SFML/System/Time.hpp:60:23: error: non-member function 'float sf::asSeconds()' cannot have cv-qualifier
float asSeconds() const;
^
C:\SFML-2.1\include/SFML/System/Time.hpp:70:5: error: 'Int32' does not name a type
Int32 asMilliseconds() const;
^
C:\SFML-2.1\include/SFML/System/Time.hpp:80:5: error: 'Int64' does not name a type
Int64 asMicroseconds() const;
^
C:\SFML-2.1\include/SFML/System/Time.hpp:85:18: error: 'Time' does not name a type
static const Time Zero; ///< Predefined "zero" time value
^
C:\SFML-2.1\include/SFML/System/Time.hpp:87:1: error: expected unqualified-id before 'private'
private :
^
C:\SFML-2.1\include/SFML/System/Time.hpp:90:5: error: 'friend' used outside of class
friend SFML_SYSTEM_API Time milliseconds(Int32);
^
C:\SFML-2.1\include/SFML/System/Time.hpp:90:33: error: expected initializer before 'milliseconds'
friend SFML_SYSTEM_API Time milliseconds(Int32);
^
C:\SFML-2.1\include/SFML/System/Time.hpp:91:5: error: 'friend' used outside of class
friend SFML_SYSTEM_API Time microseconds(Int64);
^
C:\SFML-2.1\include/SFML/System/Time.hpp:91:33: error: expected initializer before 'microseconds'
friend SFML_SYSTEM_API Time microseconds(Int64);
^
C:\SFML-2.1\include/SFML/System/Time.hpp:102:19: error: ISO C++ forbids declaration of 'Time' with no type [-fpermissive]
explicit Time(Int64 microseconds);
^
C:\SFML-2.1\include/SFML/System/Time.hpp:102:19: error: only declarations of constructors can be 'explicit'
C:\SFML-2.1\include/SFML/System/Time.hpp:102:19: error: 'Int64' was not declared in this scope
C:\SFML-2.1\include/SFML/System/Time.hpp:104:1: error: expected unqualified-id before 'private'
private :
^
In file included from C:\SFML-2.1\include/SFML/System/Clock.hpp:31:0,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:123:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time seconds(float amount);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:136:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time milliseconds(Int32 amount);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:149:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time microseconds(Int64 amount);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:161:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator ==(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:173:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator !=(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:185:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator <(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:197:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator >(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:209:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator <=(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:221:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API bool operator >=(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:232:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator -(Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:244:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator +(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:256:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator +=(Time& left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:268:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator -(Time left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:280:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator -=(Time& left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:292:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator *(Time left, float right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:304:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator *(Time left, Int64 right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:316:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator *(float left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:328:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator *(Int64 left, Time right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:340:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator *=(Time& left, float right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:352:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator *=(Time& left, Int64 right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:364:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator /(Time left, float right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:376:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time operator /(Time left, Int64 right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:388:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator /=(Time& left, float right);
^
C:\SFML-2.1\include/SFML/System/Export.hpp:43:29: error: 'SFML_API_IMPORT' does not name a type
#define SFML_SYSTEM_API SFML_API_IMPORT
^
C:\SFML-2.1\include/SFML/System/Time.hpp:400:1: note: in expansion of macro 'SFML_SYSTEM_API'
SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right);
^
In file included from C:\SFML-2.1\include/SFML/System/Clock.hpp:32:0,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/System/Time.hpp:402:1: error: expected declaration before '}' token
} // namespace sf
^
Process terminated with status 1 (0 minutes, 1 seconds)
44 errors, 1 warnings (0 minutes, 1 seconds)
Not sure what you did, but it seems like you've corrupted some SFML headers.
In file included from C:\SFML-2.1\include/SFML/System.hpp:32:0,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/Config.hpp:1:1: error: 'include' does not name a type
include <SFML/Graphics.hpp>
^
In file included from C:\SFML-2.1\include/SFML/System/Export.hpp:31:0,
from C:\SFML-2.1\include/SFML/System/Clock.hpp:31,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/Config.hpp:1:1: error: 'include' does not name a type
include <SFML/Graphics.hpp>
^
This means, that instead of having #include the '#' is missing, which should not happen, unless one manually edits the Config.hpp file.
C:\SFML-2.1\include/SFML/System/Time.hpp:40:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
SFML doesn't use C++11 yet, thus this indicates that the compiler is trying to interpret something in a wrong way.
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected primary-expression before 'public'
public :
^
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected '}' before 'public'
C:\SFML-2.1\include/SFML/System/Time.hpp:42:1: error: expected ',' or ';' before 'public'
^
In file included from C:\SFML-2.1\include/SFML/System/Clock.hpp:32:0,
from C:\SFML-2.1\include/SFML/System.hpp:33,
from C:\SFML-2.1\include/SFML/Window.hpp:32,
from C:\SFML-2.1\include/SFML/Graphics.hpp:32,
from D:\Chris\My Documents\SFML Test\main.cpp:1:
C:\SFML-2.1\include/SFML/System/Time.hpp:402:1: error: expected declaration before '}' token
} // namespace sf
^
This all may or may not be due to the corruption from above.
So what exactly did you do with the SFML headers? You should try to grab the clean ones form the download page.
I copied it straight from the tutorial. Here's what made its way into my project:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
Does this compile?
#include <SFML/Config.hpp>
int main() {}
No, I get the error "C:\SFML-2.1\include\SFML\Config.hpp|1|error: 'include' does not name a type|". Then it pulls up a config.hpp that looks like this:
include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
What about this? Does this compile if you paste it in the same project?
#include <iostream>
int main() {}
What about this? Does this compile if you paste it in the same project?
#include <iostream>
int main() {}
Yeah, that one runs just fine. Lets me add in a "Hello world" and everything.
What's the content of the Config.hpp?
The one I can access matches the one it spits out at me when it's complaining about it:
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}