Closed 461353349 closed 3 years ago
Hi, I tested CinoLib on windows, using Qt4.8, and everything works fine. Could you please be more specific on the compile errors you are receiving?
I donnot think this project could compile correctly without any modification on windows7 above. For example, There is no function random() on windows. and no definition of M_PI_2 . Furthermore, because of GLUT, so win32 not x64 is required, because of c++11, so vs2017 above is required. If we use QGLWidget on qt5.10, why GL/gl.h should be include? It would produce compile errors.
I am sure it works just because I have a number of collaborators using cinolib on Windows, and they did not report any issue to me. That being said, I am not an expert (it's been a while since the last time I used a windows machine). The only thing that comes to my mind right now is that maybe they are using a different compiler (MinGW and not MSVC). I will speak to them and get back to you ASAP. If they confirm this is a compiler issue, I will add MSVC compatibility to my TODO list. But be aware that making cinolib work with any compiler is not top priority to me right now, so I won't work on it soon.
The random() function appears only in the Shewchuk's predicates, which were written in C99, not fully supported by MSVC according to https://stackoverflow.com/questions/9610747/which-c99-features-are-available-in-the-ms-visual-studio-compiler. This is not my code, but rather a wrap of an extremely diffused tool for robust geometry processing. I therefore prefer not to edit it. At the moment I can only suggest you to either change compiler or comment that part (it won't hurt, it's just a wrap currently unused within cinolib). But thanks for the information, I will look for a more "modern" version of Shewchuk's predicates. Maybe there exists one...
Regarding includes: you are right, gl.h was unnecessary. I removed it from cinolib/gui/qt/glcanvas.h Anyways, what compile errors were you getting? Because I was getting none, and I am not aware of any other person using cinolib and getting errors to this regard.
These is the error I got when I compiled the first sample project:
E:/tools/qt/qt5101/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'E:/projects/cinolib/examples/build-01_base_app_trimesh-Desktop_Qt_5_10_1_MinGW_32bit-Debug'
g++ -c -fno-keep-inline-dllexport -Wno-deprecated-declarations -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DCINOLIB_USES_OPENGL -DCINOLIB_USES_QT -DDATA_PATH=\"E:/projects/cinolib/examples/01_base_app_trimesh/../data/\" -DQT_QML_DEBUG -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\01_base_app_trimesh -I. -I..\..\external\eigen -I..\..\include -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include\QtOpenGL -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include\QtWidgets -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include\QtGui -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include\QtANGLE -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\include\QtCore -Irelease -I..\..\..\..\tools\qt\qt5101\5.10.1\mingw53_32\mkspecs\win32-g++ -o release\main.o ..\01_base_app_trimesh\main.cpp
In file included from ..\..\include/cinolib/Shewchuk_predicates.h:70:0,
from ..\..\include/cinolib/geometry/polygon.cpp:34,
from ..\..\include/cinolib/geometry/polygon.h:104,
from ..\..\include/cinolib/meshes/abstract_polygonmesh.cpp:36,
from ..\..\include/cinolib/meshes/abstract_polygonmesh.h:180,
from ..\..\include/cinolib/meshes/trimesh.h:37,
from ..\..\include/cinolib/meshes/meshes.h:35,
from ..\01_base_app_trimesh\main.cpp:13:
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'double cinolib::doublerand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:516:14: error: 'random' was not declared in this scope
a = random();
^
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'double cinolib::narrowdoublerand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:543:14: error: 'random' was not declared in this scope
a = random();
^
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'double cinolib::uniformdoublerand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:567:14: error: 'random' was not declared in this scope
a = random();
^
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'float cinolib::floatrand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:588:14: error: 'random' was not declared in this scope
a = random();
^
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'float cinolib::narrowfloatrand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:614:14: error: 'random' was not declared in this scope
a = random();
^
..\..\include/cinolib/Shewchuk_predicates.cpp: In function 'float cinolib::uniformfloatrand()':
..\..\include/cinolib/Shewchuk_predicates.cpp:637:14: error: 'random' was not declared in this scope
a = random();
^
In file included from ..\..\include/cinolib/gl/draw_lines_tris.h:97:0,
from ..\..\include/cinolib/meshes/abstract_drawable_polygonmesh.h:38,
from ..\..\include/cinolib/meshes/drawable_trimesh.h:37,
from ..\..\include/cinolib/meshes/meshes.h:38,
from ..\01_base_app_trimesh\main.cpp:13:
..\..\include/cinolib/gl/draw_lines_tris.cpp: In function 'void cinolib::render_tris(const cinolib::RenderData&)':
..\..\include/cinolib/gl/draw_lines_tris.cpp:74:43: error: 'glGenerateMipmap' was not declared in this scope
glGenerateMipmap(GL_TEXTURE_2D);
^
In file included from ..\..\include/cinolib/meshes/drawable_trimesh.h:37:0,
from ..\..\include/cinolib/meshes/meshes.h:38,
from ..\01_base_app_trimesh\main.cpp:13:
..\..\include/cinolib/meshes/abstract_drawable_polygonmesh.h: In instantiation of 'cinolib::SurfaceMeshControlPanel<Mesh>::connect()::<lambda()> [with Mesh = cinolib::DrawableTrimesh<>]':
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:520:14: required from 'struct cinolib::SurfaceMeshControlPanel<Mesh>::connect() [with Mesh = cinolib::DrawableTrimesh<>]::<lambda()>'
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:515:25: required from 'void cinolib::SurfaceMeshControlPanel<Mesh>::connect() [with Mesh = cinolib::DrawableTrimesh<>]'
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:408:12: required from 'cinolib::SurfaceMeshControlPanel<Mesh>::SurfaceMeshControlPanel(Mesh*, cinolib::GLcanvas*, QWidget*) [with Mesh = cinolib::DrawableTrimesh<>]'
..\01_base_app_trimesh\main.cpp:30:80: required from here
..\..\include/cinolib/meshes/abstract_drawable_polygonmesh.h:44:7: warning: defaulted move assignment for 'cinolib::AbstractDrawablePolygonMesh<cinolib::Trimesh<> >' calls a non-trivial move assignment operator for virtual base 'cinolib::Trimesh<>' [-Wvirtual-move-assign]
class AbstractDrawablePolygonMesh : public virtual Mesh, public DrawableObject
^
In file included from E:/tools/qt/qt5101/Tools/mingw530_32/i686-w64-mingw32/include/c++/cassert:43:0,
from ..\..\external\eigen/Eigen/Core:289,
from ..\..\external\eigen/Eigen/Dense:1,
from ..\..\include/cinolib/geometry/tetrahedron.cpp:36,
from ..\..\include/cinolib/geometry/tetrahedron.h:73,
from ..\..\include/cinolib/meshes/tetmesh.cpp:34,
from ..\..\include/cinolib/meshes/tetmesh.h:157,
from ..\..\include/cinolib/meshes/meshes.h:43,
from ..\01_base_app_trimesh\main.cpp:13:
..\..\include/cinolib/scalar_field.cpp: In instantiation of 'void cinolib::ScalarField::copy_to_mesh(Mesh&, int) const [with Mesh = cinolib::DrawableTrimesh<>]':
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:676:52: required from 'cinolib::SurfaceMeshControlPanel<Mesh>::connect()::<lambda()> [with Mesh = cinolib::DrawableTrimesh<>]'
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:676:36: required from 'struct cinolib::SurfaceMeshControlPanel<Mesh>::connect() [with Mesh = cinolib::DrawableTrimesh<>]::<lambda()>'
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:669:25: required from 'void cinolib::SurfaceMeshControlPanel<Mesh>::connect() [with Mesh = cinolib::DrawableTrimesh<>]'
..\..\include/cinolib/gui/qt/surface_mesh_control_panel.cpp:408:12: required from 'cinolib::SurfaceMeshControlPanel<Mesh>::SurfaceMeshControlPanel(Mesh*, cinolib::GLcanvas*, QWidget*) [with Mesh = cinolib::DrawableTrimesh<>]'
..\01_base_app_trimesh\main.cpp:30:80: required from here
..\..\include/cinolib/scalar_field.cpp:77:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(rows() == m.num_verts());
^
In file included from ..\..\include/cinolib/scalar_field.h:89:0,
from ..\..\include/cinolib/gui/qt/surface_mesh_control_panel.h:36,
from ..\..\include/cinolib/gui/qt/qt_gui_tools.h:35,
from ..\01_base_app_trimesh\main.cpp:14:
..\..\include/cinolib/scalar_field.cpp:78:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(uint vid=0; vid<rows(); ++vid)
^
Makefile.Release:743: recipe for target 'release/main.o' failed
mingw32-make[1]: Leaving directory 'E:/projects/cinolib/examples/build-01_base_app_trimesh-Desktop_Qt_5_10_1_MinGW_32bit-Debug'
mingw32-make[1]: *** [release/main.o] Error 1
Makefile:36: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
Little update: I talked with some windows users, who confirmed they had to tweak something to make the library compile. I am now in the process of incorporating their local changes into the master branch.
@trlsmax, thank you for the full log. All your errors should have been fixed. I commented all the calls to the C random function (I realized they were not used in the actual predicates).
Hello, Could you please upload an update of the qt.pro file for compilation with Windows 10 and Msvc 2017 ?or at lEast give indications, since there are many compile errors (GL). thank you
Hi @yvanblanchard unfortunately I haven't been a windows user for the last 15 years so I am not an expert. That being said, I am supervising a few students that work on windows and managed to compile the library. They also experienced similar issues. Two things that I remember:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
, which is contained in the file draw_lines_tris.cpp, line 80. Just comment it out, it will do no harmI know that what I am proposing are horrible hacks, but at the moment it is not worth for me addressing these issues in a more permanent way. I plan to do major changes to the library to fix all of this, getting rid of Qt for the interface, and moving to glfw + ImGui, also implementing a shader-based rendering pipeline. I am not sure when all of this will happen, CinoLib is just a side project to support my real job (academic research). I wish my days were 48h long :P
Thank you for your help. I was able to compile and link for windows & MSVC, following these changes:
Win10, Qt5.10, vs2017, 02_base_app_quadmesh.pro
There are lots of compile error about GL.h(Windows Kits\10\Include\10.0.17134.0\um\gl\GL.h), I think it is a question.