CMake shared library on Windows: error when creating dll - windows

Using CMake (version 3.13.2) to build a shared C library on Windows with MSVC compiler (version 19.16.27025.1).
I get the following error:
Erreur MSB3073 La commande "setlocal
cd "\\vmware-host\Shared Folders\Documents\funnel\build\getopt"
if %errorlevel% neq 0 goto :cmEnd
"C:\Program Files\CMake\bin\cmake.exe" -E __create_def "//vmware-
host/Shared
Folders/Documents/funnel/build/getopt/getopt.dir/Debug/exports.def"
"//vmware-host/Shared
Folders/Documents/funnel/build/getopt/getopt.dir/Debug//objects.txt"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" s'est arrêtée avec le code 1.
Some excerpts of the CMakeLists.txt files defining the build options:
# CMakeLists.txt in root
add_compile_options(/Wall /c)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_subdirectory(getopt)
# CMakeLists.txt in root/getopt
set(src_files getopt.c getopt1.c)
set(hdr_files ansidecl.h getopt.h)
add_library(getopt SHARED "${src_files}" "${hdr_files}")
(Building STATIC library on Windows is OK. Building SHARED library on Linux with gcc is OK.)
-- EDIT (answering vre's comment) --
Running set_target_properties before call to add_library yields the following error.
set_target_properties Can not find target to add properties to: getopt
Running cmake with the proposed generator yields the following (probably because the compiler is not installed on my system though it is proposed in the list returned by cmake -H: installing this version would help?).
-- Selecting Windows SDK version to target Windows 10.0.17763.
CMake Error at CMakeLists.txt:6 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
Le fichier spécifié est introuvable
Running cmake --build [...] from console (having previously generated the build system with Visual Studio 15 2017) yields the following error.
"\\vmware-host\Shared Folders\Documents\funnel\build\ALL_BUILD.vcxproj" (cible par défaut) (1) ->
"\\vmware-host\Shared Folders\Documents\funnel\build\src\exe.vcxproj" (cible par défaut) (3) ->
"\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj" (cible par défaut) (4) ->
(PreLinkEvent cible) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(13
3,5): error MSB3073: La commande "setlocal [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: cd "\\vmware-host\Shared Folders\Documents\funnel\build\getopt" [\\vmware-host\Shared Folders\Docume
nts\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E __create_def "//vmware-host/Shared Folders/Documents/funne
l/build/getopt/getopt.dir/Release/exports.def" "//vmware-host/Shared Folders/Documents/funnel/build/getopt/getopt.dir/R
elease//objects.txt" [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [\\vmware-host\Shared Folders\Documents\fu
nnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmErrorLevel [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: exit /b %1 [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :cmDone [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\getopt
.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,
5): error MSB3073: :VCEnd" s'est arrêtée avec le code 1. [\\vmware-host\Shared Folders\Documents\funnel\build\getopt\ge
topt.vcxproj]

Related

Change default shell

I installed powershell 7, which set itself as the default shell. It messed up some apps, and I removed it. However, it's still registered as the default shell in some places. One of them is VS2022. When I build my project:
2>Target PostBuildEvent:
2> The system cannot find the path specified.
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/prj-external-libs/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/8/_tmp/cpp/build/src/Debug/proj.exe -installedDir C:/prj-external-libs/vcpkg/installed/x64-windows/debug/bin -OutVariable out
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 3.
2>Done building target "PostBuildEvent" in project "proj.vcxproj" -- FAILED.
2>
2>Done building project "proj.vcxproj" -- FAILED.
I think in general it's done via: options> environment> terminal> restore default.
However, in my case, the issue was with cmake vcpkg, which created a post build event using power shell 7. Need to delete (or just ignore) this event, or rebuild a fresh cmake.

XCopy is not working (File not found *.*)

I'm tyring to copy a folder from my Visual Studio 2015 Project's root directory into the output directory (as it breaks the application without it), so I decided to add xcopy to the post-build commands.
xcopy "$(SolutionDir)Content\*.*" "$(TargetDir)Content\" /s /i /y
I'm getting the following when it runs, and right now I can't even test this application because of xcopy.
1> File not found - *.*
1> 0 File(s) copied
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "xcopy "E:\Data\Projects\Vessel\Games\TheThing\Content\*.*" "E:\Data\Projects\Vessel\Games\TheThing\TheThing\bin\DesktopGL\AnyCPU\Debug\Content\" /s /i /y" exited with code 4.
I'm also getting problems with Xcopy and postbuild events in visual studio from time to time.
My fix is generally to create a batch script which contains the xcopy.
The batch script then is called by:
call "$(SolutionDir)scripts\copyfiles.bat"
as a post script event.

How to fix this cmd scripting string parsing error

My system path is:
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;
And I am trying to update a registry key (the system path) using a script but am getting a wierd error:
>myscript.cmd
\Python36-32\Scripts\ was unexpected at this time.
How can I fix the script error?
Here is the script:
echo off
SET PROGPATH=C:\dell\mypath
for /f "tokens=2*" %%a in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set "SysPath=%%~b"
echo system path is: %SysPath%
echo %SysPath%>tmppath.txt
echo %PATH% | findstr /i %PROGPATH%
if %ERRORLEVEL% EQU 1 (
echo %PROGPATH% path not found in system path
REM we now add to syspath and then write back to registry
set UPDATEDPATH=%PROGPATH%;%SysPath%
REM we now just write UPDATEDPATH back to registry
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v "Path" /t REG_SZ /d "%UPDATEDPATH%"
echo %PROGPATH% should now be added to the system path
) else (
echo %PROGPATH% already in path
)
The problem line is: echo %PATH% | grep %PROGPATH%
you get the error wherever there is a
C:\Program Files (x86)\Java\jre1.8.0_45\bin;
or something like that.
ie the (x86)\J or (x86)\P etc
So how to fix that?
Was asked for more details. So here.
Before running script, my env is like this:
keyname:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Path key has value:
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;
>echo %PATH%
C:\Users\angus\algs4\java\bin;C:\binaryTools\SMLNJ\bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Java\jdk1.8.0_66\bin;C:\ProgramData\Oracle\Java\javapath;C:\binaryTools;C:\Program Files (x86)\ActiveState Komodo IDE 8\;C:\PHP\;C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Program Files\Java\jdk1.8.0_66\bin;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Haskell Platform\2012.4.0.0\mingw\bin;C:\Python33;C:\Python33\Scripts;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Collaborator Client;C:\Program Files\doxygen\bin;C:\Program Files\TortoiseGit\bin;C:\Users\angus\algs4\bin;C:\Users\angus\algs4\java\bin;C:\Users\angus\AppData\Roaming\cabal\bin;C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;C:\binaryTools\emacs-24.5-bin-i686-mingw32\bin;C:\windows;C:\windows\system32;C:\Users\angus\AppData\Roaming\Dashlane\4.7.1.28771\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\angus\AppData\Roaming\Dashlane\4.7.1.28771\ucrt
now if I run the batch file contents above which I named path3.cmd I get:
>path3.cmd
\Python36-32\Scripts\ was unexpected at this time.
>
Trying
echo %PATH% | findstr /i /c:"%PROGPATH%"
or
echo "%PATH%" | findstr /i /c:"%PROGPATH%"
makes no difference.
The bug seems to be in this line:
set UPDATEDPATH=%PROGPATH%;%SysPath%

"The command SET SOLUTIONDIR exited with code 3" in Visual Studio 2015

I'm getting the following error when trying to build Hexchat in VisualStudio 2015. Some of those paths are wrong, so I would like to change them.
How do I change those path in Visual Studio 2015?
Error MSB3073 The command "
SET SOLUTIONDIR=C:\Users\olivi\Desktop\Hexchat\win32\..\
powershell -File "C:\Users\olivi\Desktop\Hexchat\win32\..\win32\version-template.ps1" "C:\Users\olivi\Desktop\Hexchat\win32\..\win32\installer\hexchat.iss.tt" "C:\Users\olivi\Desktop\Hexchat\win32\..\..\hexchat-build\Win32\bin\hexchat.iss"
"C:\Program Files (x86)\MSBuild\..\Inno Setup 5\iscc.exe" /dPROJECTDIR="C:\Users\olivi\Desktop\Hexchat\win32\installer\" /dAPPARCH="Win32" "C:\Users\olivi\Desktop\Hexchat\win32\..\..\hexchat-build\Win32\bin\hexchat.iss"
:VCEnd" exited with code 3. installer
I got this in the output window:
The specified path cannot be found
22>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(123,5): error MSB3073: The command "
22>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(123,5): error MSB3073: SET SOLUTIONDIR=C:\Users\olivi\Desktop\Hexchat\win32\..\
22>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(123,5): error MSB3073: powershell -File "C:\Users\olivi\Desktop\Hexchat\win32\..\win32\version-template.ps1" "C:\Users\olivi\Desktop\Hexchat\win32\..\win32\installer\hexchat.iss.tt" "C:\Users\olivi\Desktop\Hexchat\win32\..\..\hexchat-build\Win32\bin\hexchat.iss"
22>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(123,5): error MSB3073: "C:\Program Files (x86)\MSBuild\..\Inno Setup 5\iscc.exe" /dPROJECTDIR="C:\Users\olivi\Desktop\Hexchat\win32\installer\" /dAPPARCH="Win32" "C:\Users\olivi\Desktop\Hexchat\win32\..\..\hexchat-build\Win32\bin\hexchat.iss"
22>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(123,5): error MSB3073:
It's resulting from the following command:
<Exec Command="%(PreBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PreBuildEvent.Command)' != ''"/>

Added and removed file in VisualStudio - compile errors

My main problem is: I removed files from the ProjectMappen-Explorer (Project Explorer) and then added them again.
Now the Project does not compile anymore and i cannot find out why.
How can I make it compile again?
The Project was generated by cmake and this is some big overhead, too.
And: I want to add files on my own and this will lead to the same problem. So re-generating is useless.
Thank you for your help!
Error 1
Fehler 1 error MSB3073: Der Befehl "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\ctest.exe" --force-new-ctest-process -C Debug
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" wurde mit dem Code 8 beendet. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6 RUN_TESTS
Error 3
Fehler 3 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: bool __cdecl SolidMesh::PointInPolygonAlgorithm::pointInPolygon(class osg::Vec3f)" (?pointInPolygon#PointInPolygonAlgorithm#SolidMesh##QEAA_NVVec3f#osg###Z)" in Funktion ""public: static bool __cdecl DomAdapter::PointInPolygon(class osg::Vec3f const &,class osg::ref_ptr<class osg::TemplateArray<class osg::Vec3f,10,3,5126> > const &)" (?PointInPolygon#DomAdapter##SA_NAEBVVec3f#osg##AEBV?$ref_ptr#V?$TemplateArray#VVec3f#osg##$09$02$0BEAG##osg###3##Z)". C:\Users\wollknaeul\Documents\HPI\algorithmische geometrie\algogeometrie\trunk\build\algorithmtest\PointInPolygonTest.obj test_Algorithm
Error 4
Fehler 2 error MSB6006: "cmd.exe" wurde mit dem Code 9009 beendet. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 151 6 run
Answer to Questions
in>"C:\Program Files (x86)\CMake 2.8\bin\ctest.exe" --force-new-ctest-process -C
Debug
Test project C:/Users/wollknaeul/Documents/HPI/algorithmische geometrie/algogeom
etrie/trunk/bin
Start 1: test_Algorithm
Could not find executable test_Algorithm
Looked in the following places:
test_Algorithm
test_Algorithm.exe
Debug/test_Algorithm
Debug/test_Algorithm.exe
Debug/test_Algorithm
Debug/test_Algorithm.exe
Unable to find executable: test_Algorithm
1/1 Test #1: test_Algorithm ...................***Not Run 0.00 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.11 sec
The following tests FAILED:
1 - test_Algorithm (Not Run)
Errors while running CTest
Run Visual Studio in Administrator privileges. The error is basically that CMake can not access the C:/Program Files (x86) directory to create/add the necessary files.
Solution
Right click on Project -> Rebuild or Build again. "Neu Erstellen"
Error 1
Your first error is MSB3073 and sounds like a pre or post build issue, specifically some sort of error from a script running on your pre or post build event.
(Translating from German via translate.google.com):
The command "setlocal "C:\Program Files (x86)\CMake 2.8\bin\ctest.exe"
--force-new-ctest-process -C Debug if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with Code 8. C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6
RUN_TESTS
Are you able to run these scripts from a batch file?
Error 3 (2?)
Your second (third?) error is
LNK2019
Error 4
Google has a bunch of stuff about your last error MSB6006

Resources