Build error in Visual Studio application - visual-studio

I have a solution that I am trying to build in Visual Studio which gives the following error.
Project : error PRJ0019: A tool returned an error code from "Copy the executable to HAMR platform"
The last few lines of the build log are as follows:
Copy the executable to HAMR platform
The system cannot find the path specified.
Project : error PRJ0019: A tool returned an error code from "Copy the executable to HAMR platform"
I understand that there may be a wrong path mentioned in the code but as there is no line number to the error I don't know how to detect the source of the problem

It looks like a Post build error.
Go to Project Properties => Build Event =>Post-Build Event.
Check the command line values.
I guess you are trying to copy the source file which does not exist on the mentioned path.
Please check your output file is getting copied to the expected path or not.

It's not a source code error. It's a build step error. Right click on the project, go to settings, and check the "Build Events" tab.

Related

Reference errors when importing CubeMx project into VisualGDB

I am having some issues when importing my fresh cubeMX project into VisualGDB. I get tonnes of errors that say:
undefined reference to 'vPortFree' (for example)
Steps taken:
Generate project files in CubeMX using "Other toolchain"
Then in VS, create project using Embedded Visual GDB and mostly following default steps. I am following this process exactly. https://www.youtube.com/watch?v=XY4I0Nq6IGc
Once the project is created I try built it, but I get these errors:
Severity Description Project File Line
Error undefined reference to `vPortFree' stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3920
Error undefined reference to `vPortFree' stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3921
Error undefined reference to `vPortFree' stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3927
Error Build failed: arm-none-eabi-g++.exe exited with code 1 stm32nucleof429zi_freertos_tcpip 1
Error ld returned 1 exit status stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\collect2.exe 0
When I right click on main.c however and compile, the project compiles without fault. Its when using the build tool and debugger that these errors come up.
Ive never had this problem before when importing projects. Any help would be greatly appreciated
Thank you
After playing with configurations for some time I found the issues. The toolchain file that CubeMx created does not tell the linker to include all the files required for FreeRTOS to compile.
This issue is only relevant if you are using CMSIS_RTOS_V2 and the following steps fixed it for me:
Add CMSIS_RTOS_V2 to the project space by going to:
Add missing includes:
Go to: Project->VisualGDP Project Properties->MS build settings->Include directories and add the folder CMSIS_RTOS_V2 to the file path
To resolve the unidentified reference ‘pvPortMalloc’ error:
Within the VS in the Solution Explorer window: Click on "Show all files". This is a little icon/tab at the top of the solution explorer. Navigate to: C:\...Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang. Right click on heap_4.c and include it in the project
https://sysprogs.com/w/forums/topic/error-undefined-reference-to-pvportmalloc-and-vportfree/

error MSB6006: "lc.exe" exited with code -1

I can't build my application anymore,
every time I try to compile the following error arises.
error MSB6006: "lc.exe" exited with code -1
I've never changed anything within the Microsoft.Common.CurrentVersion.targets file (or any other file which is related to MSBuild).
Full path to the file:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets
Rows where the error seems to be/arise:
<LC
Sources="#(_LicxFile)"
LicenseTarget="$(TargetFileName)"
OutputDirectory="$(IntermediateOutputPath)"
OutputLicense="$(IntermediateOutputPath)$(TargetFileName).licenses"
ReferencedAssemblies="#(ReferencePathWithRefAssemblies);#(ReferenceDependencyPaths)"
NoLogo="$(NoLogo)"
ToolPath="$(LCToolPath)"
SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
EnvironmentVariables="$(LCEnvironment)"
MSBuildArchitecture="$(LCMSBuildArchitecture)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
>
The main problem here is that I can compile every other application, but not my most important one which is written in C# WPF with the .NET Framework 4.7.2.
Does anyone have a clue why I might can't compile the solution?
error MSB6006: “lc.exe” exited with code -1
This error means that your project has something wrong rather than Microsoft.Common.CurrentVersion.targets file
In fact, to see the specific error, you should set your Build Output log to Diagnostic/Detailed by Tools-->Options-->Projects and Solutions-->Build and Run-->set MSBuild project build output verbosity to Diagnostic/Detailed. Then when you build again, you can see the detailed info about it.
And you can try to follow these syggestions:
Please check whether you have any warnings on your nuget packages. If so, please reinstall them or just use update-Package -reinstall under Package Manage Console.
If you have any post(pre)-build event(Right-click on your project-->Properties-->Build Event), please check whether the command has some errors.
If you have licenses.licx files, you should exclude them from your project.
you can try to create a new WPF project and then add the same as the previous project to test if it is the issue of your project.
do a repair in VS Installer in case there are something with your VS Environment or update your VS to the latest version.
In addition, if possible, please share the xxxxx.csproj file of your WPF project with us to troubleshoot your issue quickly. Also, there is a similar issue about this error.

The code execution cannot proceed because CONCRT140D.dll wasn't found. Reinstalling the program may fix this probllem

I am doing some work on Microsoft Visual Studio hen I run the code. I get the only one error which is:
enter image description here
Error of missing the CONCRT140D.dll file.
The thing is I tried to download CONCRT140D.dll but at the end, the file I found is CONCRT140.dll which isn't the requirement to resolve the error.
My project directory is:
Project Directory
Project Directory

A matching symbol file was not found (Cannot find/open pdb file)

The debug point is not getting enabled when this module gets loaded. So I thought of manually loading its debug symbols .pdb file from "Debug/obj" folder.
In this case I am getting below error "A matching symbol" file was not found in this folder though that folder contains currently build file.
And also the "Symbol Load Information" contains these many directory paths.
Cannot find or open the PDB file.
PDB does not match
Screenshot:
This problem is fixed by the following steps-
1) Close all the instances of VISUAL STUDIO if running and open a single instance of Visual Studio
2) Close the solution (nothing but your project) If it's already open and then re-open again
3) Clean the whole project and rebuild it.
4) and also build the project if you are getting any errors like "___.dll not found"
5) Now you are good to go and run your project
After breaking my head on this, for me it happened when I configured my project to seperate binaries from objects that way:
For Output directory:
$(SolutionDir)build\bin\$(PlatformTarget)-$(Configuration)\
For Intermediate Directory:
$(SolutionDir)build\obj\$(PlatformTarget)-$(Configuration)\$(ProjectName)\
Even though the I still had the generated .pdb where my exe or trying to even load it manually, it didn't work.
So I went again to Configuration Properties -> Linker -> Debugging and where the property Generate Program Database File I changed from $(OutDir)$(TargetName).pdb to $(IntDir)$(TargetName).pdb so it will throw the desired database file into the place where the objects(Intermediate Directory) are instead of where the .exe(Output directory). Hopefully that helped someone :)

error MSB6006: "cmd.exe" exited with code 1

When I'm trying to build my VC++ code using 2010 I'm getting the error message
> C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
Please tell how to overcome this?
Navigate from Error List Tab to the Visual Studios Output folder by one of the following:
Select tab Output in standard VS view at the bottom
Click in Menubar View > Output or Ctrl+Alt+O
where Show output from <build> should be selected.
You can find out more by analyzing the output logs.
In my case it was an error in the Cmake step, see below. It could be in any build step, as described in the other answers.
> -- Build Type is debug
> CMake Error in CMakeLists.txt:
> A logical block opening on the line
> <path_to_file:line_number>
> is not closed.
error MSB6006: "cmd.exe" exited with code -Solved
I also face this problem . In my case it is due to output exe already running .I solved my problem simply close the application instance before building.
I had the same problem today, while I was upgrading some VC6 project to VC2012.
In my case, it was because some of the operation in Custom Built Steps failed.
In project properties, go to Custom Build Step, you can see there maybe some something in command line edit box. Open a windows prompt and paste the command to it. Run, check if there is something wrong and fix it.
If there is no command line in the project property Custom Built Step, maybe you should check properties of every single file of the project.
If the command line has some macro, replace it with an actual value.
Or you can echo the command in VS output window:
cd %(somedir)%
echo %(somedir)%
You won't miss it this way.
I solved this. double click this error leads to behavior.
open .vcxproj file of your project
search for tag
check carefully what's going inside this tag, the path is right? difference between debug and release, and fix it
clean and rebuild
for my case. a miss match of debug and release mod kills my afternoon.
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(Filename)%(Extension) ..\..\cvd\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
Actually Just delete the build ( clean it ) , then restart the compiler , build it again problem solved .
I also faced similar issue.
My source path had one directory with 'space' (D:/source 2012). I resolved this by removing the space (D:/source2012).
For the sake of future readers. My problem was that I was specifying an incompatible openssl library to build my program through CMAKE. Projects were generated but build started failing with this error without any other useful information or error. Verbose cmake/compilation logs didn't help either.
My take away lesson is that cross check the incompatibilities in case your program has dependencies on the any other third party library.
Simple and better solution :
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
I make a bat file like this
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe D:\GESTION-SOMECOPA\GestionCommercial\GestionCommercial.sln
pause
Then I can see all errors and correct them. Because when you change the folder name (without spaces as seen above) you will have another problems. Visual Studio 2015 works fine after this.
When working with a version control system where all files are read only until checked out (like Perforce), the problem may be that you accidentally submitted into this version control system one of the VS files (like filters, for example) and the file thus cannot be overridden during build.
Just go to your working directory and check that none of VS solution related files and none of temporary created files (like all moc_ and ui_ prefixed files in QT, for example) is read only.
I was in a similar situation to the one described by "irsis".
I configured the project through CMAKE, and in CmakeList, I linked the OpenCV library to the project. However, when I updated the OpenCV version for another project, the path was changed and error occurred.
Check path of all related library.
Another solution could be, that you deleted a file from your Project by just removing it in your file system, instead of removing it within your project.

Resources