3

Using Windows 7 and Visual Studio 2010 I am using the following command line as part of a larger project compilation:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I"C:\Pr ogram Files (x86)\Windows Installer XML v3.5\sdk\inc" /Zi /nologo /W3 /WX- /O 2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _WINDOWS /D USRDLL /D CUSTOMACTIONTEST EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"obj\Release\FalconViewRegistryCA.p ch" /Fo"obj\Release\" /Fd"obj\Release\vc100.pdb" /Gd /TP /analyze- /errorRep ort:queue stdafx.cpp

This error is reported:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp .Win32.Targets(57,5): error MSB6006: "CL.exe" exited with code 2.

I get the same error when I compile in the IDE and the line in Microsoft.Cpp .Win32.Targets is a conditional compile:

<CL Condition="'%(ClCompile.PrecompiledHeader)' == 'Create' and '%(ClCompile.ExcludedFromBuild)'!='true'"

I have searched for this issue and the only other issue with this problem said this was due to a path problem. error MSB6006: "CL.exe" exited with code 2

I have done a repair on Visual Studio and still get the same error. This build worked correctly on a Windows XP machine, the errors started when we were upgraded to windows 7. Any help or clarifications would be appreciated

Community
  • 1
  • 1
Jay Walther
  • 31
  • 1
  • 2

2 Answers2

0

In case it helps someone else, I also received this error and found a fix/patch.

My Conditions:

  1. Visual Studio 2015
  2. Including a file defining a template class
  3. The file had 3 template classes defined which had a dependency chain: linkedlistnode, linkedlistiterator, and linkedlist
  4. After resolving the issue, one of the classes had a build error: C2838 '=': illegal qualified name in member declaration
  5. All 3 classes were defined and declared separately (i.e. there was a class definition containing function declarations, and at the bottom of the same file the functions were defined.)

When I merged the class declarations and definitions, the MSB6006: “CL.exe” exited with code 2 was resolved.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
0

I also found that you can get a compiler melt down if a method body is compiled in a CPP file, but when the body is put into the header, the compiler doesn't fall over, and correctly reports the actual source code error that causes the problem. In my case my class definition had a typo where the class was its own base class. This was with VS2019, so there are still compiler bugs in MS VC++.