I need help building libQGLViewer as a static library (.lib) instead of a DLL.
Context:
Project Setup: I’m working on a Qt project and we are migrating from MinGW to MSVC.
Qt Version: 5.15.2
Compiler: MSVC 2019
Previous Setup: Under MinGW, we used libQGLviewer2.a without issues.
Current Issue: With MSVC, I need the equivalent libQGLviewer2.lib.
Steps I’ve Taken:
Generated a Solution with CMake:
Configured CMake to generate a Visual Studio solution for libQGLViewer.
Opened the solution in Visual Studio.
Attempted to Build:
When building the solution in Visual Studio, I encounter hundreds of errors.
The errors include syntax issues and problems related to dllimport directives, which are not allowed in this context.
Errors:
Syntax Errors: MSVC is detecting syntax errors throughout the codebase.
Dllimport Issues: There are issues with dllimport directives that are not suitable for static library creation.
Objective:
I need to generate a .lib file (static library) for libQGLViewer that can be linked in my Qt project.
Questions:
- Is there a more straightforward way to build libQGLViewer as a static
library for MSVC? - Are there specific CMake configurations or Visual
Studio settings that can help resolve the dllimport issues? - Are there any known best practices or step-by-step guides for migrating
libQGLViewer from MinGW to MSVC, specifically for creating static
libraries?
Additional Information:
I am open to adjusting CMake configurations, modifying source files, or any other necessary steps to achieve this.
Any guidance or detailed steps to resolve this would be greatly appreciated!
Thank you in advance for your help.