Why build with debug works but release doesn't? - c++

I am able to build examples in Cyclone DDS with Debug/x64 (output type is DLL ), I need to build them in Release/X64, in both builds shows the same 3 errors when I open the examples code but build always all succeed, (VS2017)
but in debug, output DLLs works fines, in release DLLs do not work
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 page says
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
And I have followed the default installation which is RelWithDebInfo
Should I build CyclonesDDS installation with -DCMAKE_BUILD_TYP=RELEASE in order to build my example code in Release/x64 mode? or should I modify the example codes?
Output window on release x64 build
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 ==========

Related

CMake trying to link with 'vulkan.lib'

I am following a Vulkan tutorial and I choose CMake as my build system. However, the build fails every time because it is trying to link with a file called 'vulkan.lib' from what I know, there's no such file as vulkan.lib because the actual library file for Vulkan is 'vulkan-1.lib'
Here is my CMake script:
project(VulkanTutorial)
set(CMAKE_CXX_STANDARD 20)
add_executable(VulkanTutorial main.cpp VulkanWindow.cpp VulkanWindow.h FirstApp.h)
add_subdirectory(deps/glfw-3.3.6)
find_package(Vulkan REQUIRED)
include_directories(deps/glfw-3.3.6/include, ${Vulkan_INCLUDE_DIRS})
target_link_libraries(VulkanTutorial glfw ${GLFW_LIBRARIES})
target_link_libraries(VulkanTutorial vulkan ${Vulkan_LIBRARIES})
And here is the build log from Visual Studio:
Build started...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
2>------ Build started: Project: glfw, Configuration: Debug x64 ------
2>Building Custom Rule C:/dev/c++/VulkanTutorial (Cmake)/deps/glfw-3.3.6/src/CMakeLists.txt
2>context.c
2>init.c
2>input.c
2>monitor.c
2>vulkan.c
2>window.c
2>win32_init.c
2>win32_joystick.c
2>win32_monitor.c
2>win32_time.c
2>win32_thread.c
2>win32_window.c
2>wgl_context.c
2>egl_context.c
2>osmesa_context.c
2>Generating Code...
2>glfw.vcxproj -> C:\dev\c++\VulkanTutorial (Cmake)\deps\glfw-3.3.6\src\Debug\glfw3.lib
3>------ Build started: Project: VulkanTutorial, Configuration: Debug x64 ------
3>Building Custom Rule C:/dev/c++/VulkanTutorial (Cmake)/CMakeLists.txt
3>main.cpp
3>VulkanWindow.cpp
3>Generating Code...
3>LINK : fatal error LNK1104: cannot open file 'vulkan.lib'
3>Done building project "VulkanTutorial.vcxproj" -- FAILED.
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks to #Stephen Newell's comment I solved it by getting rid of the vulkan in the second target_link_libraries call and it worked.

Building vcxproj file gives me a informationless error "The system cannot find the path specified"

When I build a project in vs 2017, I can get errors like this:
1>------ Build started: Project: TortoiseGitMerge, Configuration: Debug Win32 ------
1>Performing Custom Build Tools
1>The system cannot find the path specified.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 3.
1>Done building project "TortoiseMerge.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 10 up-to-date, 0 skipped ==========
In this error message, there is no information leading me closer to a solution.
Which path was specified?
How do I find out? What is the exact reason that the path in question was not written in that error message?
Performing Custom Build Tools
That isn't enough to know what is going on. You'll want to jack up the build verbosity so you can see these custom build commands getting executed. Finding the one that failed then gives you a shot at diagnosing the mishap.
Use Tools > Options > Projects and Solutions > Build and Run, "MSBuild project build output verbosity" = Detailed. The build trace you now see in the Output window gets a lot more chatty and should show the actual command that fell over.

fatal error LNK1181 when building cocos2dx game project for x64(64bit) in Visual Studio 2013?

I have created a project with Cocos2dx-2.5.5. I have built it for Win32, it works fine.
but now I am opening it in Visual studio 2013 with Debug configuration as x64(64 bit). when I am building it for local machine I am getting the following error.
1>------ Build started: Project: libcocos2d, Configuration: Debug x64 ------
2>------ Build started: Project: libExtensions, Configuration: Debug x64 ------
1>LINK : fatal error LNK1181: cannot open input file 'libpng.lib'
2>LINK : fatal error LNK1181: cannot open input file 'zlib.lib'
3>------ Build started: Project: Monroe_2013, Configuration: Debug x64 ------
3>LINK : fatal error LNK1181: cannot open input file 'libEGL.lib'
========== Build: 0 succeeded, 3 failed, 3 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
I opened proj.winrt folder with VS2013 from my project's root folder.
I have also tried adding directory to Configuration->Linker but couldn't get it work.
As you can see there are all the libraries added, which are causing that error.

Cannot open DefaultTest.dll for unit test

When I try to run my unit test in VS 2012 I get the following error:
1>------ Build started: Project: Tests, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'C:\Users\Patryk\Documents\Visual Studio 2012\Projects\LUT\Debug\DefaultTest.dll'
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
It works again, when I restart VS but then I get the same error after I have to rebuild the project
"DefaultTest.dll" is a remnant of not changing the Target Name in the project's General Configuration Properties.
The same thing happens to me in Visual Studio 2010. Removing the .dll and .dll.metagen files from the output directory and rebuilding the test project solved the problem in my case.
I get this error if the testing engine is still running in background.
Check if the vstest.executionengine.x86.exe process is still running in background, and kill it if so. Afterwards you can rebuild and run your tests.

7-Zip source compliation issue

I want to compile the console application in 7-Zip source code. But i get this error below,
1>------ Build started: Project: Console, Configuration: Debug Win32 ------
1>Linking...
1>.\Debug\7zCrcOpt.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0x268
1>Build log was saved at "file://f:\7z920\CPP\7zip\UI\Console\Debug\BuildLog.htm"
1>Console - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any help on this? thanks
Sounds like you somehow got a corrupted object file. You can remove this by using the "Clean" option from the "Build" menu (and then try building again).
Visual Studio Main Menu -> Build -> Rebuild Solution
Download and extract 7z1701.7z from http://www.7-zip.org/download.html
c:\> c:\visual-studio-10\vc\vcvarsall.bat
> devenv \CPP\7zip\UI\Console\Console.dsw
[Some Gui conversion]
> devenv c:\src\7zip3\CPP\7zip\UI\Console\Console.dsw
[error as in question]
c:\7zip\CPP\7zip\> nmake NEW_COMPILER=1 MY_STATIC_LINK=1
SUCCESS .. all the exe built.