mspraggs / potentia

Southampton Game Jam 2015
0 stars 0 forks source link

Missing file? #87

Closed DivFord closed 9 years ago

DivFord commented 9 years ago

I'm getting this when I make:

Scanning dependencies of target game [ 7%] Building CXX object CMakeFiles/game.dir/lib/AI.cpp.o In file included from /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/AI.cpp:1: In file included from /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/UnitList.hpp:5: /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/Config.hpp:6:10: fatal error: 'type_traits' file not found

include

     ^

1 error generated. make[2]: * [CMakeFiles/game.dir/lib/AI.cpp.o] Error 1 make[1]: * [CMakeFiles/game.dir/all] Error 2 make: *\ [all] Error 2

Has anyone else tried to build since the last push? I assume the push was Iain's, so my question is really, Iain, did you push type_traits?.

Fyll commented 9 years ago

Nope, that wasn't me. Seeing as I made the last push, I should be up to date, yet I have no problems compiling...

Looking at the code, type_traits looks to be a standard library, so maybe it's just not present on Mac?

DivFord commented 9 years ago

I've had a look. You're right. type_traits, unordered_maps and unique_ptr aren't in the std library on the mac. There might be a workaround, but it looks fiddly. Any way we can use more easily portable libraries? (I have no idea how this might play out on Windows).

DivFord commented 9 years ago

Apparently I'd mucked up my cmake files, and was compiling with the wrong standard libraries. Fixed now. It's getting upset about Time.hpp instead.

/Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/Time.hpp:15:17: error: use of undeclared identifier 'sleep'; did you mean 'sf::sleep'? sleep((1.0f / float(getConstant("FRAMES_PER_SECOND"))) - ((std::chrono::duration_cast<... ^~~~~ sf::sleep /Library/Frameworks/SFML.framework/Headers/System/Sleep.hpp:47:22: note: 'sf::sleep' declared here void SFML_SYSTEM_API sleep(Time duration); ^ In file included from /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/Game.cpp:4: In file included from /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/Game.hpp:8: /Users/Div/Documents/Games/Global_Game_Jam_2015/potentia/lib/Time.hpp:15:23: error: no viable conversion from 'float' to 'sf::Time' ...(1.0f / float(getConstant("FRAMES_PER_SECOND"))) - ((std::chrono::duration_cast< std::chrono::duration > (std::chrono::high_resolutionclock::now() - last)).count() / 1000.0f)... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Library/Frameworks/SFML.framework/Headers/System/Time.hpp:40:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'float' to 'const sf::Time &' for 1st argument class SFML_SYSTEM_API Time ^ /Library/Frameworks/SFML.framework/Headers/System/Time.hpp:40:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'float' to 'sf::Time &&' for 1st argument class SFML_SYSTEM_API Time ^ /Library/Frameworks/SFML.framework/Headers/System/Sleep.hpp:47:33: note: passing argument to parameter 'duration' here void SFML_SYSTEM_API sleep(Time duration);

Fyll commented 9 years ago

Okay, a few comments on this:

First of all, the old code shouldn't have worked (sleep() only has second precision, so would have been sleeping for 0s all of the time). Secondly, Macs may not have sleep(). Windows definitely doesn't. Thirdly, I've re-written it into a (hopefully) cross-platform version. I obviously can't check, but I think it's good.

It's been pushed, so have a look.

DivFord commented 9 years ago

Cool, all working now.