I am trying to setup an environment for cucumber cpp in windows 10 and with visual studio. While trying to build the whole solution, I am facing build issues with GTest component
My current environment is as follow
OS: Windows 10
Visual Studio Community Edition 2017
CMake Version:3.14.3
Ruby Version: 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
Boost Library Version: 1.69.0
I followed the steps mentioned in Readme.md
Building Cucumber-Cpp with tests and samples:
# Download test suite
git submodule init
git submodule update
# Create build directory
cmake -E make_directory build
# Generate Makefiles
cmake -E chdir build cmake -DCUKE_ENABLE_EXAMPLES=on -DCMAKE_INSTALL_PREFIX=${prefix} ..
# Build cucumber-cpp and tests
cmake --build build
I am facing build issue with GTest component. Below is the error message
========================================================
Performing build step for 'gtest'
CMake Error at C:/Cucumber/cucumber-cpp/build/gmock/src/gtest-stamp/gtest-build-Debug.cmake:49 (message):
Command failed: 1
'C:/Program Files/CMake/bin/cmake.exe' '--build' '.' '--config' 'Debug'
See also
C:/Cucumber/cucumber-cpp/build/gmock/src/gtest-stamp/gtest-build-*.log
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,
5): error MSB6006: "cmd.exe" exited with code 1. [C:\Cucumber\cucumber-cpp\build\gtest.vcxproj]
========================================================
Related
I have a question regarding dockerizing C/C++ project. I am using visual studio compiler image because I have a lot of environment trouble with running MinGW compiler.
I confirmed project using visual studio compiler image and building solution perfectly, but I'm seeing problem with actually running generated .exe file in docker container environment.
Following is my dockerfile code :
# escape=`
# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.
ARG FROM_IMAGE=microsoft/dotnet-framework:3.5-sdk-windowsservercore-1709
FROM ${FROM_IMAGE}
# Reset the shell.
SHELL ["cmd", "/S", "/C"]
# Set up environment to collect install errors.
COPY Install.cmd C:\TEMP\
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe
# Install Node.js LTS
ADD https://nodejs.org/dist/v8.11.3/node-v8.11.3-x64.msi C:\TEMP\node-install.msi
RUN start /wait msiexec.exe /i C:\TEMP\node-install.msi /l*vx "%TEMP%\MSI-node-install.log" /qn ADDLOCAL=ALL
# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman
# Download and install Build Tools for Visual Studio 2017 for native desktop workload.
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--channelUri C:\TEMP\VisualStudio.chman `
--installChannelUri C:\TEMP\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended`
--installPath C:\BuildTools
# Execute commands once container runs
# Build solution using MSVC
ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&
I copied it from microsoft official website here : https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/
and following is my output
C:\Users\cshim31\smarts-pxie-executive>docker run -v C:\Users\cshim31\smarts-pxie-executive:c:\smarts-pxie-executive -it buildtools2017native:2017 msbuild C:\smarts-pxie-executive\Project4.sln /p:Configuration=Debug /p:Platform=x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 3/10/2021 6:07:46 PM.
Project "C:\smarts-pxie-executive\Project4.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|x64".
Project "C:\smarts-pxie-executive\Project4.sln" (1) is building "C:\smarts-pxie-executive\Project4.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
Creating "x64\Debug\Project4.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
Project4.vcxproj -> C:\smarts-pxie-executive\x64\Debug\Project4.exe
FinalizeBuildStatus:
Deleting file "x64\Debug\Project4.tlog\unsuccessfulbuild".
Touching "x64\Debug\Project4.tlog\Project4.lastbuildstate".
Done Building Project "C:\smarts-pxie-executive\Project4.vcxproj" (default targets).
Done Building Project "C:\smarts-pxie-executive\Project4.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.12
C:\Users\cshim31\smarts-pxie-executive>
After building, it instantly terminated without printing out program output.
Instead, I tried going into docker environment and running .exe by myself.
and following is output :
C:\smarts-pxie-executive\x64\Debug>Project4.exe
C:\smarts-pxie-executive\x64\Debug>
it didn't print out error messages. It works perfectly fine when I opened .exe file on local computer. I am not sure how I should resolve problem since there isn't error message that I can see and fix.
I had the same issue with a Rust executable on a Docker image based on windows/servercore:ltsc2019. I used Dependency Walker to open the executable and saw that it depended on vcruntime140.dll. Then after downloading and installing the Visual C++ 2015 Redistributable package within the Docker container, my executable ran correctly.
I have a C++ project which is built with Visual Studio 2019. I started to get strange build errors in Azure Pipeline in December. Before then, the build test had passed all the time. The build is still fine on my Windows machines. It has issues only in Azure Pipeline. I get this error
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\include\memory(619,23): error C3861: '__iso_volatile_load32': identifier not found [D:\a\1\s\build\ode\raisimODE.vcxproj]
The error message seems like it is looking for ARM instructions. Here is a snippet of my build script
cd $(Build.Repository.LocalPath)
mkdir build
cd build
cmake -Q .. -G "Visual Studio 16 2019" -A x64 -DRAISIM_TEST=ON -DCMAKE_PREFIX_PATH=$(Pipeline.Workspace)\dep\raisim_env
cmake --build . --config Release
ctest -VV -C Release
cd $(Build.Repository.LocalPath)
I want to generate Visual Studio files by this instructions, and when I use the commands:
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
it says :
CMake Error at CMakeLists.txt:44 <project>:
Failed to run MSBuild command:
c:/Program files <x86>/MSBuild/14.0/bin/MSBuild.exe
to get the value of VCTargetspath:
Microsoft <R> Build Engine version 14.0.25420.1
Copyright <c? Microsoft Corporation. All rights reserved
MSBUILD : error MSB1009: Project file does not exist.
Switch: VCITargetspath.vcxproj
Exit code: 1
Configuring incomplete, errors occurred!
See also c:/Windows/System32/cpp-ethereum/build/CMakefiles/CMakeOutput.log
and also when I use the alt command:
cmake --build . --config RelWithDebInfo
it says:
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
I have to note that I have git, CMake and Visual Studio 2015 Professional fully installed.
I fork the repo and download it, then open it in the Visual Studio 2017 community and did as follows:
1:right-click the MakeLists.txt and click the Rebuild All. (x64 Debug)
2:Then, i found the build directory at here:C:\Users\SHIZU-NOTEBOOK\AppData\Local\CMakeBuild\233159a3-9dca-9735-91fc-be7911e3ef6d\build\x64-Debug\Debug
I can't find the directory like *\bin, also in cmd "pbrt" dosen't work.
Am I wrong with build?and solution!
Sincerely!
Use the cmake-gui or cmake command line tool to generate Visual Studio solution file, then build the solution.
If you choose the command line, here are steps:
Generate solution files
mkdir build && cd build
cmake .. -G "Visual Studio 15 Win64"
Now, open PBRT-V3.sln with Visual Studio 2017
Buile the solution
PS: from the readme in pbrt-v3 project, you need run git submodule update --init --recursive to fetch the dependencies.
I'm currently trying dlib 19.1 for a project.
I build all the example using cmake, and I also build dlib with VS 2013 to obtain the static lib. So I have my Install folder where the dlib are created. I compile in Release and also in Debug using the same .sln created with the cmake. So until now, no problem.
Next to that, I went in my project (a console project), and I pointed to header and lib (release and debug). Note that this project only contain a Main.cpp that call different function from my own other project libs and that main also call the face landmarks detection from dlib.
So, I have no issue to compile my project in Release with the dlib.lib that I created. But when using the debug dlib.lib and try to launch my own project in debug mode, I obtain the following error :
error LNK2001: unresolved external symbol
_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_
Is there anything done wrong ? When I'm looking to my preprocessor in cmake .sln in debug I have the _DEBUG and also in my own project.
The possible solution is to build dlib not from .sln files, but directly by cmake:
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\prj\dlib_build_release
cmake --build . --target install --config Release
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\prj\dlib_build_debug
cmake --build . --target install --config Debug
This will compile and install dlib binaries and headers into c:\prj\dlib_build_release and c:\prj\dlib_build_debug directories
After that you can use dlib compiled library from this directories