I'm getting the 'MSB6006 "CL.exe" exited with code 2' error. The problem is that my code used to work fine. The issue came when I tried to add another library from xtensor (the xtensor-blas) and I couldn't get it to work correctly. I just erased everything I tried to add and get a clean run, but it now fails every time.
While trying to compile the Error List says things like "C1083 fatal error: cannot open source file: 'files that I have deleted'". Whenever I stop the build, it then only gives the MSB6006 error.
It has become extremely frustrating since my code is identical to what it used to be and now doesn't work.
Is there any way around this?
Answer given by Quentin: There may still be references in the vcxproj file created by Visual Studio. Delete those references and it should work.
While compiling on x64 plattform I am getting following error:
c:\codavs05\hpsw-sc\ovpacc\tools\codaaccesstest\coda_access.cpp(1572): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\sizeopt.c', line 55)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
------ Build started: Project: asyncexample, Configuration: Release Win32 ------
If I change settings to preprocessor file (Yes) i am not getting any error.
About my environment: Upgrading Microsoft Visual Studio 2005 to 2010
Please help.
I have had this problem with VS2015 while building locally in Windows.
In order to solve it, I deleted my build folder (Output Directory as seen in Properties/General) and rebuilt the project.
This always seems to help when strange things happen during the build.
I’ve encountered this error many times in VC++. Do the following steps. They’ve sometimes helped me with this issue:
Take a look at the exact location, pointed out by compiler error.
Find any external types or classes used there at that location.
Change the order of “include path” of those files found in step 2 and rebuild the solution.
I hope that help !!!!
I am getting same error with VC2012. Setting up the project properties Optimization to Disabled (/Od) resolved the issue.
In my solution, i've removed output dll file of the project, and I've made project rebuild.
I encountered the same error and spent quite a bit of time hunting for the problem. Finally I discovered that function that the error was pointing to had an infinite while loop. Fixed that and the error went away.
In my case was the use of a static lambda function with a QStringList argument. If I commented the regions where the QStringList was used the file compiled, otherwise the compiler reported the C1001 error. Changing the lambda function to non-static solved the problem (obviously other options could have been to use a global function within an anonymous namespace or a static private method of the class).
I got this error using boost library with VS2017. Cleaning the solution and rebuilding it, solved the problem.
I also had this problem while upgrading from VS2008 to VS2010.
To fix, I have to install a VS2008 patch (KB976656).
Maybe there is a similar patch for VS2005 ?
I got the same error, but with a different file referenced in the error message, on a VS 2015 / x64 / Win7 build. In my case the file was main.cpp. Fixing it for me was as easy as doing a rebuild all (and finding something else to do while the million plus lines of code got processed).
Update: it turns out the root cause is my hard drive is failing. After other symptoms prompted me to run chkdsk, I discovered that most of the bad sectors that were replaced were in .obj, .pdb, and other compiler-generated files.
I got this one with code during refactoring with a lack of care (and with templates, it case that was what made an ICE rather than a normal compile time error)
Simplified code:
void myFunction() {
using std::is_same_v;
for (auto i ...) {
myOtherFunction(..., i);
}
}
void myOtherFunction(..., size_t idx) {
// no statement using std::is_same_v;
if constexpr (is_same_v<T, char>) {
...
}
}
I had this error when I was compiling to a x64 target.
Changing to x86 let me compile the program.
Sometimes helps reordering the code. I had once this error in Visual Studio 2013 and this was only solved by reordering the members of the class (I had an enum member, few strings members and some more enum members of the same enum class. It only compiled after I've put the enum members first).
In my case, this was causing the problem:
std::count_if(data.cbegin(), data.cend(), [](const auto& el) { return el.t == t; });
Changing auto to the explicit type fixed the problem.
Had similar problem with Visual Studio 2017 after switching to C++17:
boost/mpl/aux_/preprocessed/plain/full_lambda.hpp(203): fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1518)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
Solved by using Visual Studio 2019.
I first encountered this problem when i was trying to allocate memory to a char* using new char['size']{'text'}, but removing the braces and the text between them solved my problem (just new char['size'];)
Another fix on Windows 10 if you have WSL installed is to disable LxssManager service and reboot the PC.
I'm creating a project with openframeworks (the full source is here: https://github.com/morphogencc/ofxAsio/tree/master/example-udpreceiver), and the empty project seems to compile fine.
I added the ASIO library, and a few header classes, and now the project seems to be give me the following error:
1>------ Build started: Project: example-udpreceiver, Configuration: Debug x64 ------
1> main.cpp
1>cl : Command line error D8049: cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c1xx.dll': command line is too long to fit in debug record
1>cl : Command line error D8040: error creating or communicating with child process
I couldn't find any examples of error D8049 on stackoverflow or even on Microsoft's pages, and google turned up painfully few results. The only remotely useful one was this github issue:
https://github.com/deplinenoise/tundra/issues/270
But I'm still not sure what's causing the problem. Is anyone familiar with this error, and can recommend a method for troubleshooting what's causing it?
thanks in advance!
For me, working with UE4, this was an intermittent error.
I added "bLegacyPublicIncludePaths = false;" to the innermost block of project.Build.cs and recompiled without errors.
Then I removed that line and compiled again w/o errors.
The error message suggested adding "DefaultBuildSettings = BuildSettingsVersion.V2;" to project.Target.cs which worked.
This is a bit of a weird sounding error, as it is from essentially internally generated data. However, you do have control over that. Taking the error message at face value, you probably have many/lots of defined symbols passed in on the command line (or the the ones you do have have lengthy definitions), or you may have some lengthy file paths.
If you look under the project properties, one of the selections under the C++ section is "Command Line", which will show you exactly what gets passed to the compiler. When you view that you can see where you have many or lengthy parameters, and then make changes to shorten them.
Too many defines? Put them in a header (possibly stdafx.h) and include them that way.
Long file paths? Shorten the paths, put the files somewhere else, or set up file system aliases to your real directories that use shorter paths.
Asking this question preemtively because there is not much to be found about this error code. It is rather trivial to solve, but cost me a lot of time to diagnose because no proper error message is given.
So what happened?
I added templated functions to my project
Now when the project compiles, A message pops up saying that CL.exe had a problem and needs to be closed
Visual Studio aborting the compilation with error MSB6006: "CL.exe" exited with code 1
The problem were syntax errors in my template functions. Who could have guessed that.
However, it was hard to find out, because these did not get reported. See my answer for how to determine which functions are defective.
The templated functions were in a .cpp included in the header, however, defining them completely in the header did not make any difference.
// foo.h
template <typename T>
void foo();
...
#include "foo.cpp"
// foo.cpp
template <typename T>
void foo()
{
...
}
First you need to compile all .cpp files that include the templated functions seperately (select one in the project explorer, right click and "compile").
For me, the first hint was that some of them compiled, while for others cl.exe crashed.
The next step was to create a bogus.cpp file with just one function, where one by one I added calls to every templated function I created. After adding one: recompile. This went well until I got to the defective one, now the bogus.cppalso crashed cl.exe. Jackpot.
The last job was fixing the syntax error, which is annoying without error messages, but once this is done, bogus.cpp will compile again. Return to adding more function calls there until you have everything covered.
Hope I could help.
What fixed it for me was that I had two instances of Visual Studio running, and while one of them was in the middle of a debugging session, I tried to compile the other instance. Stopping the debugging session fixed this error for me.
Encountered the same issue with simple form and VS2019. This does not seem to be related necessarily to a code issue, but potentially with VS itself.
Took fresh checkout of code, built OK.
Added new tab to existing form, CL.exe exited with code 1 error.
Reverted code and added changes until error presented then could not get error to clear, event after clearing build output directories.
Completely reverted build - CL.exe exited with code 1 error.
Performed update of VS to 16.4.0 and restart PC - project builds OK.
This is a strange error. When I run my code, I had to update the location of ulldiv.asm via
implementation of unsigned long long division
the line in question matched exactly the one used in the link:http://objectmix.com/c/68732-dynamic-memory-allocation-c.html
tim = (__time64_t)((nt_time.ft_scalar - EPOCH_BIAS) / 10000000i64);
Anyways, the first link gave me the right answer and I relocated ulldiv.asm to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\crt\src\intel\ulldiv.asm.
Now when I run my code this line gives me trouble
double NOISE_SIGMA = NOISE_DENSITY*sqrt(SYS_CLK_FREQ);
the sqrt function becomes undefined (?). The debugger stops and asks me for the location of sqrt.asm.
You need to find sqrt.asm to view the source for the current call stack frame
This is a similar error that I found in a German website: http://www.c-plusplus.de/forum/324725-full
but it doesn't seem to get resolved there.
I don't understand what's going on. If you need more information regarding the code, let me know. Thank you in advance.
If it makes any difference I step through my code using F11.
While most of the source files for the Visual C++ libraries are included with the Visual Studio installation, some files are not included. Notably, the sources for the math library are not included.
The fact that the debugger cannot automatically find ulldiv.asm is a bug; this has been fixed in Visual Studio "14" (I think the fix was present in CTP1; I know for sure the fix is present in CTP3 which was released today).