Using clibgen.ge​nerateLibr​aryDefinit​ion on QT inclusive libaries

조회 수: 3 (최근 30일)
John
John 2024년 4월 16일
답변: Kautuk Raj 2024년 5월 22일
The error is similar to the one recieved in VS2022 when the project type is set incorrectly. I have the additional compiler flags added into additionalCompilerFlags, but they seem to do nothing.
Code:
headerFile = "C:\MYAPP\my_driver.h";
libFile = "C:\MyAPP\my_driver.dll";
includePath = ["C:\Qt\Qt6.7.0\6.7.0\msvc2019_64\include",...
"C:\Qt\Qt6.7.0\6.7.0\msvc2019_64\include\QtCore",...
"C:\Qt\Qt6.7.0\6.7.0\msvc2019_64\include\QtSerialPort",...
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"];
additionalCompilerFlags = "/std:c++17 /Zc:rvalueCast /Zc:inline /Zc:strictStrings /Zc:throwingNew /permissive- /Zc:__cplusplus /Zc:externConstexpr /utf-8 /w34100 /w34189 /w44996 /w44456 /w44457 /w44458";
libName = "MYLIB";
clibgen.generateLibraryDefinition(headerFile, "Libraries", libFile, "PackageName", libName, "IncludePath", includePath, 'AdditionalCompilerFlags', additionalCompilerFlags)
Error:
Errors parsing interface generation files.
C:\Qt\Qt6.7.0\6.7.0\msvc2019_64\include\QtCore\qcompilerdetection.h(460):
warning: this feature-test macro is ignored (and returns 0) in the current compilation mode
C:\Qt\Qt6.7.0\6.7.0\msvc2019_64\include\QtCore\qcompilerdetection.h(1257):
error: #error directive: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus
option to the compiler."

답변 (1개)

Kautuk Raj
Kautuk Raj 2024년 5월 22일
I can observe that you are facing compilation errors due to Qt's C++17 requirements and potentially incorrect compiler flag settings in MATLAB.
From the information provided, I can see that the IncludePath refers to this path:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include". Here, Visual Studio 14.0 refers to Visual Studio 2015, which is not supported by MATLAB R2023b.
Reproducing from the above document: Visual Studio Community, Professional, and Enterprise editions are supported. The “Desktop development with C++” workload is required for MEX and associated functionality.
I trust this response will guide you towards resolving your problem.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by