samsface / godot-native-example

Example Godot native project using cmake
MIT License
32 stars 11 forks source link

'MSB3073 The command "setlocal' error occurs seemingly randomly when installing #4

Closed DrBoontis closed 2 years ago

DrBoontis commented 2 years ago

I know my code is fine because I don't receive any errors when building the project and I have been able to occasionally get the install to work and test my C++ code in Godot, but more often than not I get this error whenever I try to install.

I've tried a couple of solutions from googling the error, which included unsetting all of the project files from read-only and running VS in admin mode, but neither of those made any difference. The only solution out of the three I've tried that seemed to have some effect was restarting my computer. After rebooting my system without making any changes to my code I stopped receiving the error for around two hours until it suddenly started happening again.

Here's an image of the error and the code it takes me to when I double-click it: error

samsface commented 2 years ago

setLocal isn't the error, that just means something else went wrong. Can you post the full output from the Output tab instead of the Error List (it's the lab to the right of Error List in your screenshot).

Also this issue seems pretty similar: https://github.com/samsface/godot-native-example/issues/3

DrBoontis commented 2 years ago

I looked at the other issue you linked and then tried installing with the Godot editor closed and... yup, that seems to be what I was doing wrong. I'll still post the log you asked for just in case something else is happening that you'd be able to see, but I'm pretty sure I got things working now.

One last thing before we close this issue, is it possible to leave the editor running while I edit and save my code or do I just have to accept the extra cumbersomeness of closing it whenever I want to make changes? I have no problem dealing with it if there isn't, but if there's a simple way to make this happen then that'd be cool.

(Username omitted to preserve anonymity) Build started... 1>------ Build started: Project: INSTALL, Configuration: Debug x64 ------ 1>-- Install configuration: "Debug" 1>-- Up-to-date: C:/Users/[OMITTED]/godot-native-example/work/../app/addons/example/./gdnative-example.lib 1>-- Installing: C:/Users/[OMITTED]/godot-native-example/work/../app/addons/example/./gdnative-example.dll 1>CMake Error at cmake_install.cmake:49 (file): 1> file INSTALL cannot copy file 1> "C:/Users/[OMITTED]/godot-native-example/work/Debug/gdnative-example.dll" to 1> "C:/Users/[OMITTED]/godot-native-example/work/../app/addons/example/./gdnative-example.dll": 1> Permission denied. 1> 1> 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Msbuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 1. 1>Done building project "INSTALL.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

samsface commented 2 years ago

I haven't been able to reproduce this issue on Windows so it is possible. But not sure why this is happening for some people.

DrBoontis commented 2 years ago

Understandable. Windows tends to act very strange at times. Anyway, thanks for the help! Your tutorial was extremely helpful and I don't believe I would have been able to get C++ working in my project without it.