VS2017 compile error

Questions related to plugins development
Post Reply
CCNewbieL6
Posts: 23
Joined: Wed Jan 27, 2021 11:11 am

VS2017 compile error

Post by CCNewbieL6 »

Hello everyone:
I am a newbie in cloudcompare. Recently, I want to develop a plugin for cloudcompare. There are something wrong.
I have already compiled the cloudcompare and its plugins via VS 2015 and VS 2017 with QT5.12.2. That's all correct.
However, when I start a new QT project(SubSampleTools), something wrong happened:

########This is my include path: D:\GraduationProject\repos\to_cmake_build\CloudCompare\build2017\plugins\example\ExamplePlugin\ExamplePlugin_autogen\include_Release;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\plugins\example\ExamplePlugin\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\build2017\libs\qCC_db\extern\CCCoreLib\exports;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_db\extern\CCCoreLib\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\CCPluginAPI\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\CCPluginStub\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_glWindow\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_db\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\CCFbo\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_io\include;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_io\extern\dxflib\src;
D:\GraduationProject\repos\to_cmake_build\CloudCompare\libs\qCC_io\extern\shapelib;
C:\Qt\5.12.2\msvc2017_64\include;
C:\Qt\5.12.2\msvc2017_64\include\QtConcurrent;
C:\Qt\5.12.2\msvc2017_64\include\QtCore;
C:\Qt\5.12.2\msvc2017_64\.\mkspecs\win32-msvc;
C:\Qt\5.12.2\msvc2017_64\include\QtOpenGL;
C:\Qt\5.12.2\msvc2017_64\include\QtWidgets;
C:\Qt\5.12.2\msvc2017_64\include\QtGui;
C:\Qt\5.12.2\msvc2017_64\include\QtANGLE;
C:\Qt\5.12.2\msvc2017_64\include\QtOpenGLExtensions;
%(AdditionalIncludeDirectories)


######VS 2017 compile output:

1>------ 已启动生成: 项目: SubSampleTools, 配置: Release x64 ------
1>moc SubSampleTools.h
1>SubSampleToolsDlg.cpp
1>SubSampleTools.cpp
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\cctypes.h(15): error C2338: type for ScalarType has not been declared (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(127): error C2061: 语法错误: 标识符“ScalarType” (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(131): error C2065: “count”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(131): error C2065: “out”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(135): error C2065: “out”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(140): error C2065: “count”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(140): error C2065: “out”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\include\ccserializableobject.h(144): error C2065: “out”: 未声明的标识符 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): error C2737: “CCCoreLib::ScalarType”: 必须初始化“constexpr”对象 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): error C2146: 语法错误: 缺少“;”(在标识符“ZERO_TOLERANCE_SCALAR”的前面) (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): error C2923: “std::numeric_limits”: 对于参数“_Ty”,“CCCoreLib::ScalarType”不是有效的 模板 类型变量 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): note: 参见“CCCoreLib::ScalarType”的声明 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): error C2955: “std::numeric_limits”: 使用 类 模板 需要 模板 参数列表 (编译源文件 SubSampleTools.cpp)
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\limits(70): note: 参见“std::numeric_limits”的声明 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(51): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(51): error C2737: “CCCoreLib::ScalarType”: 必须初始化“constexpr”对象 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(51): error C2086: “const int CCCoreLib::ScalarType”: 重定义 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): note: 参见“CCCoreLib::ScalarType”的声明 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(51): error C2146: 语法错误: 缺少“;”(在标识符“ZERO_TOLERANCE_POINT_COORDINATE”的前面) (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C2737: “CCCoreLib::ScalarType”: 必须初始化“constexpr”对象 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C2086: “const int CCCoreLib::ScalarType”: 重定义 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): note: 参见“CCCoreLib::ScalarType”的声明 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C2146: 语法错误: 缺少“;”(在标识符“NAN_VALUE”的前面) (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C2923: “std::numeric_limits”: 对于参数“_Ty”,“CCCoreLib::ScalarType”不是有效的 模板 类型变量 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(48): note: 参见“CCCoreLib::ScalarType”的声明 (编译源文件 SubSampleTools.cpp)
1>d:\graduationproject\repos\to_cmake_build\cloudcompare\libs\qcc_db\extern\cccorelib\include\ccconst.h(63): error C2955: “std::numeric_limits”: 使用 类 模板 需要 模板 参数列表 (编译源文件 SubSampleTools.cpp)
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\limits(70): note: 参见“std::numeric_limits”的声明 (编译源文件 SubSampleTools.cpp)
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.cpp(13): error C2027: 使用了未定义类型“Ui::SubSampleToolsDlg”
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.h(9): note: 参见“Ui::SubSampleToolsDlg”的声明
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.cpp(27): error C2027: 使用了未定义类型“Ui::SubSampleToolsDlg”
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.h(9): note: 参见“Ui::SubSampleToolsDlg”的声明
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.cpp(33): error C2027: 使用了未定义类型“Ui::SubSampleToolsDlg”
1>c:\users\36392\source\repos\subsampletools\subsampletools\subsampletoolsdlg.h(9): note: 参见“Ui::SubSampleToolsDlg”的声明
1>已完成生成项目“SubSampleTools.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: VS2017 compile error

Post by daniel »

How have you created your new plugin? Are you using the dummy plugin example that's shipped with CloudCompare? And then running CMake again and enable this plugin?

Another rather safe way to do it is to copy an existing plugin, and rename everything (basically everywhere you find the copied plugin name).
Daniel, CloudCompare admin
CCNewbieL6
Posts: 23
Joined: Wed Jan 27, 2021 11:11 am

Re: VS2017 compile error

Post by CCNewbieL6 »

Thank you for your reply !
The project above is not the qDummyPlugin or ExamplePlugin.
At the first time, I used the CloudCompare\plugins\example\ExamplePlugin . Then the code about cloudcompare performed well. But An error caused by QT :

1>Automatic MOC and UIC for target ExamplePlugin
1> Creating library D / graduationproject / repos / to_ cmake_ build/CloudCompare/build2017/plugins/example/ExamplePlugin/Release/ ExamplePlugin.lib And object D / graduationproject / repos / to_ cmake_ build/CloudCompare/build2017/plugins/example/ExamplePlugin/Release/ ExamplePlugin.exp
1> ExamplePlugin.obj : error LNK2019: unresolved external symbol 'public:__ cdecl ExamplePluginDlg::ExamplePluginDlg(class QWidget *)" (??0ExamplePluginDlg@@ QEAA@PEAVQWidget@@@Z )In the function "public: void"__ cdecl ExamplePlugin::doAction(void)" (? doAction@ExamplePlugin@@QEAAXXZ )Quoted in
1> ExamplePlugin.obj : error LNK2019: unresolved external symbol 'public: virtual'__ cdecl ExamplePluginDlg::~ExamplePluginDlg(void)" (??1ExamplePluginDlg@@ UEAA@XZ )In the function "public: void"__ cdecl ExamplePlugin::doAction(void)" (? doAction@ExamplePlugin@@QEAAXXZ )Quoted in
1>D:\GraduationProject\repos\to_ cmake_ build\CloudCompare\build2017\plugins\example\ExamplePlugin\Release\ ExamplePlugin.dll : fatal error lnk1120: 2 unresolved external commands
1> Finished building project“ ExamplePlugin.vcxproj ”Operation for - failed.
==========Generation: 0 succeeded, 1 failed, the latest 10, 0 skipped==========

If I introduce the *.ui file and .h .cpp about QT, the error will occur. If I remove the *.ui file, the error disappear.
So I started a QT project(in last post) in VS. I hanve tested the QT environment of this project. It is ok. When I introduce the code about Cloudcompare, the problem in last post occured.
I have not try the qDummyPlugin. I will have a try. By the way, I have found the qDummyPlugin link : https://github.com/tristorcelli/CloudCo ... ummyPlugin
Do you have any other idea to solve my problem?
Thank you very much!
CCNewbieL6
Posts: 23
Joined: Wed Jan 27, 2021 11:11 am

Re: VS2017 compile error

Post by CCNewbieL6 »

I solved the error which is in the first post.

VS show that " type for ScalarType has not been declared.". So I try to find where ScalarType is. Then I found that CloudCompare\libs\qCC_db\extern\CCCoreLib\include\CCTypes.h has the declaration:

Code: Select all

//! Type of a single scalar field value
#if defined CC_CORE_LIB_USES_DOUBLE
using ScalarType = double;
#elif defined CC_CORE_LIB_USES_FLOAT
using ScalarType = float;
#else
static_assert(false, "type for ScalarType has not been declared");
#endif
I think variable CC_CORE_LIB_USES_DOUBLE and CC_CORE_LIB_USES_FLOAT have not been defined. So the error occured.
I try to edit it :

Code: Select all

//! Type of a single scalar field value
#if defined CC_CORE_LIB_USES_DOUBLE
using ScalarType = double;
#elif defined CC_CORE_LIB_USES_FLOAT
using ScalarType = float;
#else
using ScalarType = double;
//static_assert(false, "type for ScalarType has not been declared");
#endif
The error gone.
Last edited by CCNewbieL6 on Mon Apr 05, 2021 8:29 am, edited 1 time in total.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: VS2017 compile error

Post by daniel »

Ah yes, that has changed recently.

To make things clean, you should define 'CC_CORE_LIB_USES_FLOAT' in your Visual Studio project properties ("precompiler options"). There's also a way to do it with CMake (if you are using CMake).
Daniel, CloudCompare admin
Post Reply