为什么使用调试构建有效但发布无效?

时间:2021-03-15 08:04:21

标签: c++ debugging dll build release

我可以使用 Debug/x64 在 Cyclone DDS 中构建 examples(输出类型是 DLL ),我需要在 Release/X64 中构建它们,当我打开 { {3}} 代码但构建总是全部成功,(VS2017)

但在调试中,输出 DLL 工作正常,在发布 DLL 中不起作用

examples

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

enter image description here 页说

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 ==========

0 个答案:

没有答案