patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Errors in building the project with Visual Studio 2015 in Windows 10 #214

Closed Wasseem81 closed 5 years ago

Wasseem81 commented 5 years ago

Hi I got this error when building the project in Visual Studio 2015 in Windows 10. Could you please help?

5> generate-obj.cpp 3>C:\Users\WNI\Desktop\eos_cmake\include\eos/cpp17/optional.hpp(31): fatal error C1083: Cannot open include file: 'optional': No such file or directory 2>C:\Users\WNI\Desktop\eos_cmake\include\eos/cpp17/optional.hpp(31): fatal error C1083: Cannot open include file: 'optional': No such file or directory 4>C:\Users\WNI\Desktop\eos_cmake\include\eos/cpp17/optional.hpp(31): fatal error C1083: Cannot open include file: 'optional': No such file or directory 5>C:\Users\WNI\Desktop\eos_cmake\include\eos/render/detail/texturing.hpp(81): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data 5>C:\Users\WNI\Desktop\eos_cmake\include\eos/render/detail/texturing.hpp(81): warning C4244: 'initializing': conversion from 'float' to 'unsigned char', possible loss of data 5>C:\Users\WNI\Desktop\eos_cmake\include\eos/render/detail/texturing.hpp(81): warning C4244: 'initializing': conversion from 'float' to 'const unsigned char', possible loss of data 5>C:\Users\WNI\Desktop\eos_cmake\include\eos/cpp17/optional.hpp(31): fatal error C1083: Cannot open include file: 'optional': No such file or directory 7>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------

patrikhuber commented 5 years ago

If you read the readme, you'll read that VS 2015 is no longer officially supported. There is some chance that it might still work - it seems the wrong define branch gets chosen here and it tries to include <optional>, which VS 2015 doesn't have. You can investigate why it doesn't use the latter branch and adjust the define accordingly.

Wasseem81 commented 5 years ago

Thank you for your quick response. I tried with Visual Studio 2017 15.7.5 on Windows 10 and got the following errors:

4>C:\Users\WNI\Desktop\eos_cmake\examples\fit-model-simple.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj 4>Done building project "fit-model-simple.vcxproj" -- FAILED. 2>C:\Users\WNI\Desktop\eos_cmake\examples\fit-model.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj 2>Done building project "fit-model.vcxproj" -- FAILED. 3>C:\Users\WNI\Desktop\eos_cmake\examples\fit-model-multi.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj 3>Done building project "fit-model-multi.vcxproj" -- FAILED.

patrikhuber commented 5 years ago

Just do what it says, add /bigobj to the compiler flags.

Wasseem81 commented 5 years ago

I did it and it worked. I tried to add MATLAB bindings where I am using MATLAB R2018a but got this error:

2>c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h(1102): error C3861: 'mxGetPiIsDeprecated': identifier not found

patrikhuber commented 5 years ago

As the compiler error tells you, this error is coming from 3rdparty\mexplus\include\mexplus\mxarray.h. Maybe Matlab removed this deprecated function - in that case, an earlier version of the MCR will probably work. Perhaps you might also want to file an issue in the mexplus repo.

Wasseem81 commented 5 years ago

I tried with earlier versions of MCR. However, all of them produces much more different errors. What version of MATLAB did you use to compile the code successfully?

patrikhuber commented 5 years ago

It has been a few months since I last compiled them so I'm not 100% sure, but I think 2017b should work fine (and 2017a possibly too). What where the errors with these?

Wasseem81 commented 5 years ago

I generated the code using CMake (3.11.4) with MATLAB R2017b and Visual Studio 2017 (15.7). Then I tried to build the code using Visual Studio 2017 (15.7) but I got these errors:

Error C2039 'begin': is not a member of 'Eigen::Matrix<float,3,1,0,3,1>' eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2039 'end': is not a member of 'Eigen::Matrix<float,3,1,0,3,1>' eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1223
Error C2672 'std::copy': no matching overloaded function found eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2780 '_DestTy std::copy(_ExPo &&,_FwdIt1,_FwdIt1,_DestTy (&)[_DestSize]) noexcept': expects 4 arguments - 2 provided eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_FwdIt2 std::copy(_ExPo &&,_FwdIt1,_FwdIt1,_FwdIt2) noexcept': expects 4 arguments - 2 provided eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_DestTy
std::copy(_InIt,_InIt,_DestTy (&)[_DestSize])': expects 3 arguments - 2 provided eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_OutIt std::copy(_InIt,_InIt,_OutIt)': expects 3 arguments - 2 provided eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2039 'begin': is not a member of 'Eigen::Matrix<float,2,1,0,2,1>' eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2039 'end': is not a member of 'Eigen::Matrix<float,2,1,0,2,1>' eos-matlab-render c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1223
Error C2039 'begin': is not a member of 'Eigen::Matrix<float,3,1,0,3,1>' eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2039 'end': is not a member of 'Eigen::Matrix<float,3,1,0,3,1>' eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1223
Error C2672 'std::copy': no matching overloaded function found eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2780 '_DestTy std::copy(_ExPo &&,_FwdIt1,_FwdIt1,_DestTy (&)[_DestSize]) noexcept': expects 4 arguments - 2 provided eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_FwdIt2 std::copy(_ExPo &&,_FwdIt1,_FwdIt1,_FwdIt2) noexcept': expects 4 arguments - 2 provided eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_DestTy
std::copy(_InIt,_InIt,_DestTy (&)[_DestSize])': expects 3 arguments - 2 provided eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2780 '_OutIt std::copy(_InIt,_InIt,_OutIt)': expects 3 arguments - 2 provided eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1224
Error C2039 'begin': is not a member of 'Eigen::Matrix<float,2,1,0,2,1>' eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1222
Error C2039 'end': is not a member of 'Eigen::Matrix<float,2,1,0,2,1>' eos-matlab-fitting c:\users\wni\desktop\eos_cmake\3rdparty\mexplus\include\mexplus\mxarray.h 1223

patrikhuber commented 5 years ago

According to this issue, the eos-matlab-fitting bindings work (and I tested them back in May). The eos-matlab-render bindings are not updated and don't compile though. Make sure you're on the latest branch.

Wasseem81 commented 5 years ago

What do you mean by "Make sure you're on the latest branch." ? How can I get the latest eos-matlab-fitting and eos-matlab-render bindings ?

patrikhuber commented 5 years ago

I should've said "commit" probably. These commits from May updating the eos-matlab-fitting bindings should be in the master branch.

Wasseem81 commented 5 years ago

I already used the bindings in the master branch and got the above errors. Now I got confused I used the same versions of Visual Studio and MATLAB that you used but I could not run the SFM. BTW, I used only two dependencies which are: boost 1.67.0 and opencv 3.4.1.

Is that okay to generate the code with CMake successfully ?

patrikhuber commented 5 years ago

Yea it should be, at least for the eos-matlab-fitting bindings. I'm sorry currently don't have time to look into it further - the eos-matlab-render bindings are harder to fix but the eos-matlab-fitting bindings should work, as mentioned. You can try to get them to work by yourself, or I recommend that you use the Python bindings, they're officially supported and much better. Maybe one day I (or someone) will find the time to rewrite the Matlab bindings with Mathworks' new C++ API.