Cinder icon indicating copy to clipboard operation
Cinder copied to clipboard

Fix using std::filesystem when not available

Open dimateos opened this issue 2 years ago • 3 comments

Ref https://github.com/cinder/Cinder/issues/2316

I simply removed the _MSC_VER check.

Feel free to edit or discard. Cheers!

dimateos avatar Oct 26 '23 11:10 dimateos

The Debug target seems to have a few errors. If you can fix those, I'll run the tests again.

paulhoux avatar Nov 15 '23 15:11 paulhoux

Seems like MSVC does not define __cplusplus according to the picked std=c++XX prior to 2017. Moreover, due to legacy code expecting it to still be 199711L this is disabled by default and requires /Zc:__cplusplus.

ref : https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/

Instead, we can additionally check _MSVC_LANG which always reports the c++ std version Basically, when /Zc:__cplusplus is enabled: __cplusplus == _MSVC_LANG

ref: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

I added the explanation to the file too

dimateos avatar Nov 16 '23 08:11 dimateos

Well there were a few more issues, like the source .cpp not added to the solution (thats why I missed updating it). Basically the project compiled in c17 because ghc was not being used, otherwise it would have failed at the linker stage when using the lib i.e. in the samples.

Now I tested both and succesfully compiled cinder with c17 and c14, plus also a few samples with either c++ using the output lib :)

dimateos avatar Nov 16 '23 10:11 dimateos