I have a project that I\'m building in C++ in Release mode in Visual Studio 2008 SP1 on Windows 7 and when I build it I keep getting:
fatal error C104
Check if you have a .pch
(precompiled header) file somewhere in the project directory and erase it. then rebuild the project.
The best way to get a clean build is using Build->Clean or Build->Rebuild All
Edit: Another thing you can try that is pretty much fail safe is to recreate the project file in a new directory from only the source files.
If that works then you can incrementally compare the old project with the new one to see what does wrong.
I would suggest reinstalling VS 2008 SP1. Have you installed a different VS (e.g. VS Express) in the meantime? This is known to cause interference with an existing VS installation.
You could try checking the compiler and linker versions by running cl.exe
and link.exe
from the Visual Studio command prompt.
I had the same problem too, and my visual Studio About box reported I had SP1 installed. Apparently that was not entirely true. Investigation on my specific occurance to this problem reveiled the resource compiler seemed to be the culprid. It happened to be an older version, that caused the mentioned error message. My installed hotfixes (Windows update) did not solve that problem. Maybe I missed a crucial one.....
Hopefully we once experience the day developers will actually communicate back the real problem in their generated error messages. :-) 'an older version of a compiler....' come on guys, you can do better than that ;-)
Anyways, here is the downloadlink to the latest SP1 for VS2008 i've used to solve this problem.
http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en
Happy coding.
Anyone finding this thread looking for answers... I ran into this as well, but it wasn't a SP1 problem or a rebuild problem or a PCH problem... it ended up being a library that was built with a more recent version of VS trying to link into a project on the older VS. While that sounds obvious, the odd part was VS2008 was reporting that an object that it compiled was the cause of the problem which sent me on a wild goose chase...
I had the same problem, but a straight up reinstall did not fix it. I was using the version I found here
https://www.dreamspark.com/Products/Product.aspx?ProductId=9
However, after trawling forums I found that installing VS2008 SP1 Express eliminates this problem. . . .
http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=f3fbb04e-92c2-4701-b4ba-92e26e408569
You have to be careful which place you download VS2008 from as different versions of the same Express product are available for download.
I was able to fix this problem in VS 2015 with the following steps.
[1] (Not sure this was necessary) Turn off /GL in all components
C/C++ > Optimization > Whole program Optimization > No
In the .VCXPROJ files it's:
<WholeProgramOptimization>false</WholeProgramOptimization>
Turn off /LTCG
Librarian > General > Link Time Code Generation
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
[2] More important step, make sure all components are drawing from the same directories. My main EXE was using:
Release Include
$(WindowsSdkDir)include\um;$(WindowsSdkDir)include\shared;$(UniversalCRT_IncludePath);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include
Release Library
$(VC_LibraryPath_x86);$(WindowsSdk_71A_LibraryPath_x86);
The .lib was using different directories (wrong):
Release Include
$(VC_IncludePath);$(WindowsSDK_IncludePath);
Release Library
$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86
I changed the .lib directories to be the same as the .exe, and the compilation error disappeared.