LiangliangNan / Easy3D

A lightweight, easy-to-use, and efficient C++ library for processing and rendering 3D data
GNU General Public License v3.0
1.35k stars 243 forks source link

Compile error using QT #176

Closed Kraj413 closed 7 months ago

Kraj413 commented 7 months ago

Making compile error in Tutorial_204_Viewer_Qt and Mapple using QT when using Visual Studio 2022

error C2065: 'GL_MAJOR_VERSION': undeclared identifier error C2065: 'GL_MINOR_VERSION': undeclared identifier error C2065: 'GL_RENDERBUFFER_SAMPLES': undeclared identifier error C2065: 'GL_MAX_SAMPLES': undeclared identifier error C3861: 'glDepthRange': identifier not found error C3861: 'glDepthRange': identifier not found

I see GL_MAJOR_VERSION is in glew.h but once I include that header file by #include <easy3d/renderer/opengl.h> or directly including glew.h, getting other compile error.

I will appreciate if anyone can help me to compile two projects successfully.

LiangliangNan commented 7 months ago

Can you post your complete CMake log and VS compilation log here? I suspect that an unsupported Qt was used by your visual studio.

Kraj413 commented 7 months ago

Thank you for your feedback. I used Qt 5.6.3 and VS 2022. CMakeConfigureLog.yaml.txt

LiangliangNan commented 7 months ago

That is not the log of the CMake process of the project. Besides, please also attach the VS complication log.

Nowadays it is quite common multiple Qt versions exist in a machine and these log may tell us which Qt was used.

Kraj413 commented 7 months ago

Actually I am not good at cmake. I will appreciate if you let me find the right cmake log. Here is VS log. Tutorial_204_Viewer_Qt.log

Kraj413 commented 7 months ago

What is the prefered QT version? Testing with Qt5.12.7, it makes no compile errors but so much link errors regarding Qt.

LiangliangNan commented 7 months ago

Is your Qt targetted for (or built by) VS 2022? Your used Qt libraries must be compitable with your compiler. The path to the Qt libraries on my tested machine is D:\dev\Qt5.15.2\5.15.2\msvc2019_64\lib. On this path you see msvc2019_64. This means the libraries are for VS 2019 (and they are typically not compitable with other VS versions).

Again, nowadays it is quite common multiple Qt versions exist in a machine, you must make sure you used the intended version of Qt and the existing Qt libraries are compitable with VS 2022.

LiangliangNan commented 7 months ago

Actually I am not good at cmake. I will appreciate if you let me find the right cmake log. Here is VS log. Tutorial_204_Viewer_Qt.log

I need the complete log (not part of it), which is the output of VS when you compile/build the project. On my machine it looks like vs-log.txt.

Similarly, the CMake log is the log information CMake produced when you configure the project using CMake:

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.18362.
The C compiler identification is MSVC 19.29.30153.0
The CXX compiler identification is MSVC 19.29.30153.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
-- Setting C++11
Performing Test CMAKE_HAVE_LIBC_PTHREAD
Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Looking for pthread_create in pthreads
Looking for pthread_create in pthreads - not found
Looking for pthread_create in pthread
Looking for pthread_create in pthread - not found
Found Threads: TRUE  
GLFW including Win32 support
Performing Test COMPILER_HAS_DEPRECATED_ATTR
Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
Performing Test COMPILER_HAS_DEPRECATED
Performing Test COMPILER_HAS_DEPRECATED - Success
Adding target: easy3d::util (easy3d_util)
Adding target: easy3d::core (easy3d_core)
Adding target: easy3d::fileio (easy3d_fileio)
Adding target: easy3d::kdtree (easy3d_kdtree)
Adding target: easy3d::algo (easy3d_algo)
Found Boost: D:/dev/boost_1_80_0 (found version "1.80.0")  
Adding target: easy3d::renderer (easy3d_renderer)
Found OpenGL: opengl32  found components: OpenGL 
OpenGL library: opengl32
Adding target: easy3d::gui (easy3d_gui)
Adding target: easy3d::viewer (easy3d_viewer)
CMake Warning at tutorials/Tutorial_203_Viewer_wxWidgets/CMakeLists.txt:9 (message):
  Tutorial_203_Viewer_wxWidgets requires wxWidgets but wxWidgets was not
  found.  You can set 'wxWidgets_ROOT_DIR' to the root directory of wxWidgets
  (e.g., 'D:/dev/wxWidgets-3.2.1') to help CMake find wxWidgets.  Without
  wxWidgets, you will still be able to use all other features provided by
  Easy3D.

****************************************************************************
    Package       : Easy3D
    Version       : 2.5.2
    Generator     : Visual Studio 16 2019
    Configuration : Debug;Release;MinSizeRel;RelWithDebInfo
    System        : 64-bit Windows
----------------------------------------------------------------------------
    Build shared libraries :  ON
    Build tutorials        :  ON
    Build documentation    :  OFF
    Build tests            :  OFF
    With CGAL (>= v5.1)    :  OFF
    With Qt5 (>= v5.6)     :  OFF
    With ffmpeg (>= v3.4)  :  OFF
----------------------------------------------------------------------------
    Build directory        :  F:/3_code/Easy3D-build-vs2022
    Installation directory :  C:/Program Files/Easy3D/2.5.2
****************************************************************************
Configuring done
LiangliangNan commented 7 months ago

I will close this issue because it is not related to Easy3D bug or issues, but programming skills and use of develpment tools.

Kraj413 commented 7 months ago

Many thanks for your help. You are right I installed the other Qt version 5.15.2 and Easy3D is working well now.