I recently decided to dive into game development using SFML, and thought that the Arkanoid clone tutorial would be a good place to start. However, I keep on getting errors in the code, and even downloading the source gives me these same errors.
The code as I have it is:
#ifdef SFML_STATIC
#pragma comment(lib, "glew.lib")
#pragma comment(lib, "freetype.lib")
#pragma comment(lib, "jpeg.lib")
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "gdi32.lib")
#endif // SFML_STATIC
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
const int windowWidth{ 800 }, windowHeight{ 600 };
int main()
{
RenderWindow window{ { windowWidth, windowHeight }, "Arkanoid - 1" };
window.setFramerateLimit(60);
while (true)
{
window.clear(Color::Black);
if (Keyboard::isKeyPressed(Keyboard::Key::Escape)) break;
window.display();
}
return 0;
}
The errors I received from the VS2013 are :
- 1: Line 16 - int should be preceded by a ;
- 2: Line 16 - missing type specifier, int assumed
- 3: Line 20 - Element '1' - conversion from 'initializer-list' to 'sf::VideoMode' requires a narrowing conversion
- 4: Line 20 - same, but from 'int' to 'unsigned int'
- 5: Line 20 - same as 4, but applying to Element '2'
I was able to fix the two errors for line sixteen (the const expr) by changing it to simply a const. I would like to know how to keep from having to do this, however.
Line 20 in my code (in case it doesn't show up) is the RenderWindow line, in case that helps.
Thank you!