yfeng95 / face3d

Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.
2.65k stars 611 forks source link

linux cython compile error #31

Closed TychoKoster closed 5 years ago

TychoKoster commented 5 years ago

I get this message when I run python setup.py build_ext -i, can someone help me out? I can't seem to find a fix for this.

running build_ext skipping 'mesh_core_cython.cpp' Cython extension (up-to-date) building 'mesh_core_cython' extension gcc -pthread -B /home/tychokoster/anaconda3/envs/3dmm_cnn/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include -I/home/tychokoster/anaconda3/envs/3dmm_cnn/include/python2.7 -c mesh_core_cython.cpp -o build/temp.linux-x86_64-2.7/mesh_core_cython.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0, from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from mesh_core_cython.cpp:607: /home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

warning "Using deprecated NumPy API, disable it by " \

^ gcc -pthread -B /home/tychokoster/anaconda3/envs/3dmm_cnn/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tychokoster/anaconda3/envs/3dmm_cnn/lib/python2.7/site-packages/numpy/core/include -I/home/tychokoster/anaconda3/envs/3dmm_cnn/include/python2.7 -c mesh_core.cpp -o build/temp.linux-x86_64-2.7/mesh_core.o cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ mesh_core.cpp: In function ‘void _write_obj_with_colors_texture(std::string, std::string, float, int, float, float, int, int, int)’: mesh_core.cpp:349:31: error: no matching function for call to ‘std::basic_ofstream::basic_ofstream(std::string&)’ ofstream obj_file(filename); ^ mesh_core.cpp:349:31: note: candidates are: In file included from mesh_core.h:9:0, from mesh_core.cpp:11: /usr/include/c++/4.9/fstream:643:7: note: std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode] basic_ofstream(const char __s, ^ /usr/include/c++/4.9/fstream:643:7: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string}’ to ‘const char*’ /usr/include/c++/4.9/fstream:628:7: note: std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits] basic_ofstream(): __ostream_type(), _M_filebuf() ^ /usr/include/c++/4.9/fstream:628:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/4.9/fstream:602:11: note: std::basic_ofstream::basic_ofstream(const std::basic_ofstream&) class basic_ofstream : public basic_ostream<_CharT,_Traits> ^ /usr/include/c++/4.9/fstream:602:11: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string}’ to ‘const std::basic_ofstream&’ error: command 'gcc' failed with exit status 1

ieee-wangwei commented 5 years ago

This problem happened since the "setup.py" for compiling Cython extension did not use c++11 std, may be you can see https://codeday.me/bug/20181230/494221.html for some compiling information. I also met the same problem, and after I added "extra_compileargs=["-std=c++11"]" in setup.py, the compilation passed. I hope it is useful. ^^

TychoKoster commented 5 years ago

Thank you very much! This solved my issue :)

FrankYoungchen commented 5 years ago

Thank you very much! I meet such problem

Rock-100 commented 5 years ago

Wonderful! It worked!

jinxinbao commented 4 years ago

So cool!

sunyuxiu commented 1 year ago

This problem happened since the "setup.py" for compiling Cython extension did not use c++11 std, may be you can see https://codeday.me/bug/20181230/494221.html for some compiling information. I also met the same problem, and after I added "extra_compileargs=["-std=c++11"]" in setup.py, the compilation passed. I hope it is useful. ^^

Hi,can you share the setup.py with me?I add the "extra_compil_args["-std=c++11"] " in setup.py.However,it still occurs the same problem.