cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.28k stars 939 forks source link

Fix using std::filesystem when not available #2317

Open dimateos opened 8 months ago

dimateos commented 8 months ago

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

I simply removed the _MSC_VER check.

Feel free to edit or discard. Cheers!

paulhoux commented 7 months ago

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

dimateos commented 7 months ago

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 commented 7 months ago

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 :)