benikabocha / saba

OpenGL Viewer (OBJ PMD PMX)
MIT License
442 stars 60 forks source link

Can support Windows MinGW compilation? #7

Closed sway913 closed 6 years ago

sway913 commented 6 years ago

I found that some function parameters are different from the MinGW header file type.

benikabocha commented 6 years ago

Thank you.

This problem is because there is no wstring version of fstream in MinGW.

Have you found any other problems as well?

sway913 commented 6 years ago

G:/work/3D_opengl/depends/include/fpp.h:159:12: error: expected initializer before 'fppPreProcess' int PREFIX fppPreProcess(REG(a0) struct fppTag ); ^~~~~ H:\test\saba\viewer\Saba\GL\GLSLUtil.cpp: In function 'bool saba::PreprocessGLSL(std::__cxx11::string, saba::GLSLShaderLang, const string&, const saba::GLSLDefine&, const saba::GLSLInclude&, std::__cxx11::string)': H:\test\saba\viewer\Saba\GL\GLSLUtil.cpp:521:14: error: 'FPPTAG_FILE_OPEN_EXT' was not declared in this scope tag.tag = FPPTAG_FILE_OPEN_EXT; ^~~~~~~~ H:\test\saba\viewer\Saba\GL\GLSLUtil.cpp:521:14: note: suggested alternative: 'PIMAGE_FILE_HEADER' tag.tag = FPPTAG_FILE_OPEN_EXT; ^~~~~~~~ PIMAGE_FILE_HEADER H:\test\saba\viewer\Saba\GL\GLSLUtil.cpp:582:15: error: 'fppPreProcess' was not declared in this scope auto ret = fppPreProcess((fppTag)tags.data()); ^~~~~ H:\test\saba\viewer\Saba\GL\GLSLUtil.cpp:582:15: note: suggested alternative: 'OpenProcess' auto ret = fppPreProcess((fppTag*)tags.data());

I can make sure that the library of FCPP is compiled successfully, because I can run fpp.exe, and it is also dependent on fpp.dll and libfpp.dll.a. I don't know why it's a mistake to compile Saba now.

sway913 commented 6 years ago

in MinGW, we should replace #if _WIN32 to #if _WIN32 && defined(_MSC_VER)。 should not be used the fcpp at https://github.com/bagder/fcpp。Because the code doesn't match

benikabocha commented 6 years ago

I fixed this problem. Please try MinGW build again.

I tested it in the following environment.

sway913 commented 6 years ago

[ 98%] Built target SabaViewer Scanning dependencies of target saba_viewer [ 99%] Building CXX object CMakeFiles/saba_viewer.dir/saba_viewer.cpp.obj H:\test\saba\saba_viewer.cpp: In function 'int SabaViewerMain(const std::vector<std::__cxx11::basic_string >&)': H:\test\saba\saba_viewer.cpp:238:10: error: 'class saba::Viewer' has no member named 'ExecuteCommand' viewer.ExecuteCommand(viewerCommand); ^~~~~~ make[2]: [CMakeFiles\saba_viewer.dir\build.make:63: CMakeFiles/saba_viewer.dir/saba_viewer.cpp.obj] Error 1 make[1]: [CMakeFiles\Makefile2:70: CMakeFiles/saba_viewer.dir/all] Error 2 make: *** [Makefile:83: all] Error 2

sway913 commented 6 years ago

[100%] Linking CXX executable saba_viewer.exe CMakeFiles\saba_viewer.dir/objects.a(saba_viewer.cpp.obj):saba_viewer.cpp:(.text+0x2068): undefined reference to `saba::Viewer::Initialize(saba::Viewer::InitializeParameter const&, int, int)' collect2.exe: error: ld returned 1 exit status make[2]: [CMakeFiles\saba_viewer.dir\build.make:106: saba_viewer.exe] Error 1 make[1]: [CMakeFiles\Makefile2:70: CMakeFiles/saba_viewer.dir/all] Error 2 make: *** [Makefile:83: all] Error 2

benikabocha commented 6 years ago

I don't know this function. saba::Viewer::Initialize(saba::Viewer::InitializeParameter const&, int, int)

The original code is this. saba/viewer/Saba/Viewer/Viewer.h : 62 saba::Viewer::Initialize(const saba::Viewer::InitializeParameter&)

benikabocha commented 6 years ago

Please check that it has not been changed from the original source code.

https://github.com/benikabocha/saba/blob/4c8604e6629b62c7e081426cf519bb1ed30e79ad/viewer/Saba/Viewer/Viewer.h#L62

https://github.com/benikabocha/saba/blob/4c8604e6629b62c7e081426cf519bb1ed30e79ad/saba_viewer.cpp#L231