STORM-IRIT/OpenGR

Is VC++ a supported platform

Closed this issue · 9 comments

I ask as when I call nmake I get:

C:\3rdPartyLibs\OpenGR\src\gr\io\io.cc(154): error C2440: 'initializing': cannot convert from 'std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>' to 'std::basic_string<char,std::char_traits,std::allocator>'
C:\3rdPartyLibs\OpenGR\src\gr\io\io.cc(154): note: No constructor could take the source type, or constructor overload resolution was ambiguous
jom: C:\3rdPartyLibs\OpenGR\VC2017\src\gr\io\CMakeFiles\opengr_io.dir\build.make [src\gr\io\CMakeFiles\opengr_io.dir\io.cc.obj] Error 2

As described here (see windows builds section), you need a recent version of VS to compile the code.
Could you post your compiler version ?
Also, did you use a standalone version for cmake, or instead use VS directly as suggested in the documentation ?

It have a recent compiler and use cmake 3.15.0 from the command line. As the boost::filesystem::path::native() returns a wide string on Windows as documented here, it seems normal that it cannot be assigned to a std::string.

Btw, in Necip's branch boost::filesystem is no longer used, so that is a fix for the issue.

Hum yes, right.
It is true that Boost is not tested on windows with the current test suite (only linux and mac on travis). Other compilers seems to be fine with this conversion.

Boost filesystem is used only to load mtl files associated to meshes stored as obj. Do you need this now ? I am afraid I will not be able to fix it before next week.

As I wrote Necip's branch does the job for me.

Ok great, it should be merged next week as well.

Side note: with Necip branch, the library is 100% header only, except the IO package.
As such, it will be moved to the apps, and the build chain updated.
This change will be part of the new version 1.2, see PR #37

The reason for this issue is because boost typedef wchar_t as value type for windows. I use the following codes to resolve this issue:
#ifdef USE_BOOST
using namespace boost;
const wstring wworkingDir = filesystem::path(filename).parent_path().native()
+ filesystem::path::preferred_separator;
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conv;
const string workingDir = conv.to_bytes(wworkingDir);
#endif

@easterngarden do you still need this trick on current master ?

Seems deprecated, closing.