c++ - 为什么使用调试进行构建但发布没有?
问题描述
我能够在 Cyclone DDS 中使用 Debug/x64 构建示例(输出类型为 DLL ),我需要在 Release/X64 中构建它们,当我打开示例代码时,两个构建都显示相同的 3 个错误,但构建总是成功, (VS2017)
但在调试中,输出 DLL 工作正常,在发布 DLL 中不起作用
Severity Code Description Project File Line Suppression State
Error (active) E1097 unknown attribute "no_init_all"
ddscxxHelloworldSubscriberDLL C:\Program Files (x86)\Windows
Kits\10\Include\10.0.19041.0\um\winnt.h 3901
Severity Code Description Project File Line Suppression State
Error (active) E0090 function returning function is not allowed
ddscxxHelloworldSubscriberDLL
C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\include\ddscxx\dds\sub\detail\TDataReaderImpl.hpp 186
Severity Code Description Project File Line Suppression State
Error (active) E0090 function returning function is not allowed
ddscxxHelloworldSubscriberDLL
C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\include\ddscxx\dds\sub\detail\TDataReaderImpl.hpp 318
Github页面说
Note that the default build type is a release build with debug information included (RelWithDebInfo),
which is generally the most convenient type of build to use from applications because of a good mix
between performance and still being able to debug things. If you'd rather have a Debug or pure
Release build, set CMAKE_BUILD_TYP
我遵循了默认安装,即 RelWithDebInfo
我应该使用 -DCMAKE_BUILD_TYP=RELEASE 构建 CyclonesDDS 安装,以便在 Release/x64 模式下构建示例代码吗?还是我应该修改示例代码?
发布 x64 版本的输出窗口
ld All started: Project: ZERO_CHECK, Configuration: Release x64 ------
2>------ Rebuild All started: Project: startClient, Configuration: Release x64 ------
3>------ Rebuild All started: Project: startServer, Configuration: Release x64 ------
1>Checking Build System
4>------ Rebuild All started: Project: isocpp_idlpp, Configuration: Release x64 ------
4>Building Custom Rule C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/helloworldDLLsource/CMakeLists.txt
5>------ Rebuild All started: Project: ddscxxHelloWorldData_lib_idl_isocpp_generate, Configuration: Release x64 ------
3>startServer.cpp
2>startClient.cpp
3> Creating library C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startServer.lib and object C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startServer.exp
3>Generating code
3>All 14 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
3>Finished generating code
2> Creating library C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startClient.lib and object C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startClient.exp
2>Generating code
2>All 14 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
2>Finished generating code
3>startServer.vcxproj -> C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startServer.exe
5>Running isocpp_idlpp on HelloWorldData.idl
2>startClient.vcxproj -> C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\x64\Release\startClient.exe
5>Compiling C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\helloworldDLLsource\HelloWorldData.idl
5>Building Custom Rule C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/helloworldDLLsource/CMakeLists.txt
5>ANTLR Tool version 4.4 used for code generation does not match the current runtime version 4.5ANTLR Tool version 4.4 used for code generation does not match the current runtime version 4.5
6>------ Rebuild All started: Project: ddscxxHelloworldPublisherDLL, Configuration: Release x64 ------
7>------ Rebuild All started: Project: ddscxxHelloworldSubscriberDLL, Configuration: Release x64 ------
7>Building Custom Rule C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/helloworldDLLsource/CMakeLists.txt
6>Building Custom Rule C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/helloworldDLLsource/CMakeLists.txt
7>subscriber.cpp
6>publisher.cpp
6>HelloWorldData.cpp
7>HelloWorldData.cpp
6>HelloWorldDataSplDcps.cpp
7>HelloWorldDataSplDcps.cpp
7>Generating Code...
6>Generating Code...
7>HelloWorldData-cyclone.c
6>HelloWorldData-cyclone.c
7> Creating library C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/DDS_DLL_PROJECT_2017/Release/ddscxxHelloworldSubscriberDLL.lib and object C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/DDS_DLL_PROJECT_2017/Release/ddscxxHelloworldSubscriberDLL.exp
6> Creating library C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/DDS_DLL_PROJECT_2017/Release/ddscxxHelloworldPublisherDLL.lib and object C:/Users/king/Downloads/DDS_2017_Build/cyclonedds_cxx_ins_dir_2017/DDS_3_15/DDS_DLL_PROJECT_2017/Release/ddscxxHelloworldPublisherDLL.exp
7>ddscxxHelloworldSubscriberDLL.vcxproj -> C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\Release\ddscxxHelloworldSubscriberDLL.dll
6>ddscxxHelloworldPublisherDLL.vcxproj -> C:\Users\king\Downloads\DDS_2017_Build\cyclonedds_cxx_ins_dir_2017\DDS_3_15\DDS_DLL_PROJECT_2017\Release\ddscxxHelloworldPublisherDLL.dll
8>------ Skipped Rebuild All: Project: ALL_BUILD, Configuration: Release x64 ------
8>Project not selected to build for this solution configuration
========== Rebuild All: 7 succeeded, 0 failed, 1 skipped ==========
解决方案
推荐阅读
- java - Java条件语句混淆
- java - 将视图模型作为参数传递
- angular - 虚拟滚动显示具有快速动态滚动的移动设备上的空白
- python - 为什么“for letter in line”有效,而如果“word=line.strip()”,“for letter in word”无效。**字符串搜索**在文件中**
- oop - 如何命名一个属性很少且没有方法的类,其实例会被大量传递?
- download - 计算机科学中大写“KB”的值是多少?CS中的大写“KB”和小写“kb”有什么区别?
- angular - 当参数在 JSON 中时,Ionic 5 Post 请求添加额外的参数
- java - 在安装 8 的同时打开一个 java12 jar 文件
- java - 在响应应用程序中返回 200 响应但不返回数据,其中直接在浏览器上点击 url 获得响应
- r - 如何在数据框的所有列上运行 for 循环并将结果作为单独的数据框或矩阵返回