#include <SFML/System.hpp>
#include <iostream>
int main()
{
sf::Clock clock;
while (true)
{
if (clock.getElapsedTime().asSeconds() > 2)
{
clock.restart();
std::cout << "Hello world!\n";
}
}
}
There used to be creating a TcpSocket and Sound in there as well, but this is the simple part. Still errors.
Okay so I've taken a look at your project file and found two important mistakes:
- You're trying to link x64 libraries, but you've specified to us the x86 compiler. Visual Studio 2012 (> Express) ships with a x86 and a x64 compiler. If you want to change it, then you'll have to change the compiler. Usually you can find a dropdown box next to the "Debug/Release" mode changer, which has by default "Win32" writtin in it. You'll now have to manually add the new compiler and you'll have to readjust the project settings.
- You've in "Code Generation" set the "Runtime Library" to /MTd, which is incompatible with the /MDd flag SFML is build. You can link the runtime library statically (/MTd) only if you link SFML statically (see the lib/std-static directory from the nightly build).
After changing those two settings, the application complied, although the code within Main.cpp doesn't make much sense.
if (clock.getElapsedTime().asSeconds()) ;