LINK : fatal error LNK1104: cannot open file 'Debug\stdafx.obj'

Locked LINK : fatal error LNK1104: cannot open file 'Debug\stdafx.obj'

  • Tuesday, December 27, 2011 7:54 PM
     
     

    I have an error when I try to compile anything with VC++ 2010 Express. That error is:

    LINK : fatal error LNK1104: cannot open file 'Debug\stdafx.obj'

    I had the exact same problem with VC++ 2008 Express also. I tried everything I could think of and all the suggestions made on various forums/etc to get that sorted out and I was never able to do it. I've cheaked all the setting, tried a different user name on the same computer, turning off precompiled headers, reseting the IDE to it's defaults... etc... etc... nothing has worked.

    So I finally decided to unistall 2008 and install 2010, hoping the problem would be resolved. But I'm having the same problem with 2010. I'm really hoping someone can help me with this.

    I'm just trying to compile the console program that gets created when you create a new console program. No extra code or includes or anything. I have changed any of the compiler/IDE default settings.

    If I compile in debug mode, I get the above error. If I compile in release mode, I get:

    1>LINK : fatal error LNK1181: cannot open input file 'Release\stdafx.obj'

    And that's about the extent of it.

    Here's the build log:

    Build started 12/27/2011 2:51:35 PM.
         1>Project "c:\Users\Code\documents\visual studio 2010\Projects\test1\test1\test1.vcxproj" on node 2 (build target(s)).
         1>PrepareForBuild:
             Creating directory "c:\users\code\documents\visual studio 2010\Projects\test1\Release\".
           InitializeBuildStatus:
             Creating "Release\test1.unsuccessfulbuild" because "AlwaysCreate" was specified.
           ClCompile:
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"Release\test1.pch" /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Release\test1.pch" /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt test1.cpp
           Link:
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"c:\users\code\documents\visual studio 2010\Projects\test1\Release\test1.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\test1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\users\code\documents\visual studio 2010\Projects\test1\Release\test1.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"c:\users\code\documents\visual studio 2010\Projects\test1\Release\test1.lib" /MACHINE:X86 Release\stdafx.obj
             Release\test1.obj
         1>LINK : fatal error LNK1181: cannot open input file 'Release\stdafx.obj'
         1>Done Building Project "c:\Users\Code\documents\visual studio 2010\Projects\test1\test1\test1.vcxproj" (build target(s)) -- FAILED.

    Build FAILED.

    Time Elapsed 00:00:00.68

    Any help is greatly appreciated.

All Replies

  • Tuesday, December 27, 2011 7:58 PM
     
     
    Did you actually look in the Release folder to see if the stdafx.obj file was built?
  • Tuesday, December 27, 2011 8:04 PM
     
     

    Yes, and it wasn't. Here's the contents of the release folder:

    link.command.1.tlog, link.read.1.tlog, link.write.1.tlog, test1.log, cl.command.1.tlog, cl.read.1.tlog, cl.write.1.tlog, test1.lastbuildstate, test1.unsuccessfulbuild

    No sign of it anywhere.

  • Wednesday, December 28, 2011 2:06 PM
     
     

    Ok, I just uninstalled everything related to VS (even C# which was working fine), cleaned out all the registry entries I could find, deleted the VS folder from Program Files, cleaned out the AppData folder, deleted the VS projects folder in My Documents, emptied the Temp folder...

    I restarted the system and then reinstalled VC++ 2010.

    I opened VC++, created a new console program without changing any settings and tried to compile it.

    Same problem...

  • Wednesday, December 28, 2011 2:20 PM
     
     

    Looks like not only stdafx.obj is missing, test1.obj is missing too. And some other files that are normally generated during build like test1.pch.

    Can you post the contents of cl.write.1.tlog?

  • Wednesday, December 28, 2011 2:30 PM
     
     

    Here's what's in cl.write.1.tlog:

    ^C:\USERS\CODE\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\TEST1\TEST1\STDAFX.CPP
    C:\USERS\CODE\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\TEST1\TEST1\RELEASE\VC100.PDB
    ^C:\USERS\CODE\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\TEST1\TEST1\TEST1.CPP
    C:\USERS\CODE\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\TEST1\TEST1\RELEASE\VC100.PDB

  • Wednesday, December 28, 2011 2:36 PM
     
     

    OK, that's weird, according to the build log compilation finished successfully but according to the cl.write file no obj files were written, as if compilation failed.

    I'd try creating the project in another location, preferably on another partition. And turn off the antivirus if you have one.

  • Wednesday, December 28, 2011 2:49 PM
     
      Has Code

    Antivirus & firewall disabled. I created a new project folder on my thumb drive and tried to compile in it. Same results.

    Here's cl.write.1.tlog:

    ^Z:\VISUAL STUDIO 2010\PROJECTS\TEST2\TEST2\STDAFX.CPP
    Z:\VISUAL STUDIO 2010\PROJECTS\TEST2\TEST2\DEBUG\VC100.PDB
    ^Z:\VISUAL STUDIO 2010\PROJECTS\TEST2\TEST2\TEST2.CPP
    Z:\VISUAL STUDIO 2010\PROJECTS\TEST2\TEST2\DEBUG\VC100.PDB

    And the test2.log:

    Build started 12/28/2011 9:45:36 AM.
         1>Project "Z:\Visual Studio 2010\Projects\test2\test2\test2.vcxproj" on node 2 (build target(s)).
         1>PrepareForBuild:
             Creating directory "Z:\Visual Studio 2010\Projects\test2\Debug\".
           InitializeBuildStatus:
             Creating "Debug\test2.unsuccessfulbuild" because "AlwaysCreate" was specified.
           ClCompile:
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"Debug\test2.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\test2.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt test2.cpp
           ManifestResourceCompile:
             C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"Debug\test2.exe.embed.manifest.res" Debug\test2_manifest.rc 
           Link:
             C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"Z:\Visual Studio 2010\Projects\test2\Debug\test2.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\test2.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"Z:\Visual Studio 2010\Projects\test2\Debug\test2.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"Z:\Visual Studio 2010\Projects\test2\Debug\test2.lib" /MACHINE:X86 Debug\test2.exe.embed.manifest.res
             Debug\stdafx.obj
             Debug\test2.obj
         1>LINK : fatal error LNK1104: cannot open file 'Debug\stdafx.obj'
         1>Done Building Project "Z:\Visual Studio 2010\Projects\test2\test2\test2.vcxproj" (build target(s)) -- FAILED.
    Build FAILED.
    Time Elapsed 00:00:03.13

     

  • Wednesday, December 28, 2011 4:16 PM
     
     
    I agree with Mike. This is really weird. At this point I'd be using Sysinternals Process Monitor to see the stdafx.obj being created and finding out what happens to it and why it disappears before the linker gets a hold of it.
  • Wednesday, December 28, 2011 7:03 PM
     
     

    stdafx.obj is never getting created and I don't see where CreateFile() failed for it anywhere (using Process Monitor). It's like the compiler never attempts to create it.

    On another note, I was looking at enviroment variables and I noticed that I don't have any in PATH for VC++... is this correct?

    I'll keep checking it out in Process Monitor, but I'm not hopeful.

    I really need to get this sorted out and I would welcome any more ideas on it.

  • Thursday, December 29, 2011 12:52 AM
     
     

    stdafx.obj is never getting created...

    Ok, so what happens if you compile stdafx.cpp explicitly? If stdafx.ob doesn't get created, there must be an error message. If there is no error message, the Process Monitor will show where stdafx.obj is created.
  • Thursday, December 29, 2011 2:17 AM
     
     
    >Here's the contents of the release folder:

    If VC++ 2010 is the same as 2008, there will be *two*
    "Release" (or "Debug") directories for a Project. If so,
    show the contents of *both* "Release" (or "Debug")
    directories.

    Tip: From the command line, in the root directory for
    the Project, enter this:

    dir /on /s > dir.txt

    and press Enter.

    Post the contents of the dir.txt file here.

    - Wayne

  • Thursday, December 29, 2011 9:42 AM
    Moderator
     
     

    Hi Fyntun,

    I think the error may be caused by the precompiled header configuration. Please open the project's property page, and then choose "Create (/Yc)" option for Configuration properties->C/C++->Precompiled Headers->Precompiled Header. Then recompile the project and run the application again.

    If you want to know more about error LNK1104, please refer to this link: http://msdn.microsoft.com/en-us/library/ts7eyw4s(v=VS.100).aspx.

    If the problem still exists, please post back. We'll continue working with you on this issue.

    Best regards,

    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
  • Thursday, December 29, 2011 4:42 PM
     
     

    @Brian Muth:

    I can't figure out what's wrong by using Process Monitor. I'm sure there's a way to do it, but I'm not really familiar with it.

    I can't see where stdafx.obj is ever being created even when I compile stdafx.cpp exclusively. I do see that cl.exe is launched, but I don't see any write failures after that or anything. And I don't see it trying to create stdafx.obj anywhere even though there are no errors and the compiler reports that it compiles successfully.

    If you could maybe tell my what to filter in Process Monitor or how to set it up to get what I need, that would really help.

    @WayneAKing:

    Here is dir.txt:

     Volume in drive C has no label.
     Volume Serial Number is B0AC-B885

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4

    12/29/2011  11:16 AM    <DIR>          .
    12/29/2011  11:16 AM    <DIR>          ..
    12/29/2011  10:08 AM    <DIR>          Debug
    12/29/2011  11:16 AM                 0 dir.txt
    12/29/2011  09:36 AM    <DIR>          ipch
    12/29/2011  11:12 AM    <DIR>          Release
    12/29/2011  11:12 AM    <DIR>          test4
    12/29/2011  11:12 AM         2,576,384 test4.sdf
    12/29/2011  11:12 AM               891 test4.sln
                   3 File(s)      2,577,275 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\Debug

    12/29/2011  10:08 AM    <DIR>          .
    12/29/2011  10:08 AM    <DIR>          ..
                   0 File(s)              0 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\ipch

    12/29/2011  09:36 AM    <DIR>          .
    12/29/2011  09:36 AM    <DIR>          ..
    12/29/2011  11:11 AM    <DIR>          test4-5872c0ab
                   0 File(s)              0 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\ipch\test4-5872c0ab

    12/29/2011  11:11 AM    <DIR>          .
    12/29/2011  11:11 AM    <DIR>          ..
    12/29/2011  11:11 AM         2,359,296 test4-3f50d93a.ipch
    12/29/2011  09:36 AM         2,359,296 test4-ab1603c0.ipch
                   2 File(s)      4,718,592 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\Release

    12/29/2011  11:12 AM    <DIR>          .
    12/29/2011  11:12 AM    <DIR>          ..
                   0 File(s)              0 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\test4

    12/29/2011  11:12 AM    <DIR>          .
    12/29/2011  11:12 AM    <DIR>          ..
    12/29/2011  10:16 AM    <DIR>          Debug
    12/28/2011  12:47 PM             1,701 ReadMe.txt
    12/29/2011  11:12 AM    <DIR>          Release
    12/28/2011  12:47 PM               292 stdafx.cpp
    12/28/2011  12:47 PM               320 stdafx.h
    12/28/2011  12:47 PM               314 targetver.h
    12/28/2011  12:47 PM               158 test4.cpp
    12/28/2011  12:47 PM             4,362 test4.vcxproj
    12/28/2011  12:47 PM             1,329 test4.vcxproj.filters
    12/28/2011  12:47 PM               143 test4.vcxproj.user
                   8 File(s)          8,619 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\test4\Debug

    12/29/2011  10:16 AM    <DIR>          .
    12/29/2011  10:16 AM    <DIR>          ..
    12/29/2011  11:06 AM               820 cl.command.1.tlog
    12/29/2011  11:06 AM                 2 cl.read.1.tlog
    12/29/2011  11:06 AM               318 cl.write.1.tlog
    12/29/2011  11:06 AM               714 test4.log
    12/29/2011  10:08 AM                 0 test4.unsuccessfulbuild
                   5 File(s)          1,854 bytes

     Directory of C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\test4\Release

    12/29/2011  11:12 AM    <DIR>          .
    12/29/2011  11:12 AM    <DIR>          ..
    12/29/2011  11:12 AM               844 cl.command.1.tlog
    12/29/2011  11:12 AM                 2 cl.read.1.tlog
    12/29/2011  11:12 AM               322 cl.write.1.tlog
    12/29/2011  11:12 AM               850 test4.log
                   4 File(s)          2,018 bytes

         Total Files Listed:
                  22 File(s)      7,308,358 bytes
                  23 Dir(s)  274,385,010,688 bytes free

    @Helen Zhao:

    The "Create (/Yc)" precompiled header option is already selected and that's what I've been compiling with.


    And this forum takes some getting used to.
  • Thursday, December 29, 2011 6:48 PM
     
     

    >On another note, I was looking at enviroment variables and
    >I noticed that I don't have any in PATH for VC++... is this
    >correct?

    It depends. How did you check the PATH? Did you open a
    console window and check it from there? If so, *how* did
    you open the console window? It makes a difference.

    e.g. - If you just open it by using the Start menu and
    "Run": cmd
    you probably won't see the VC++ paths in the PATH setting.

    To check it for the compiler, from the IDE click on the "Tools"
    menu and choose "Visual Studio 2010 Command Prompt".
    That will open a console window with all of the environment
    variables set correctly for VC++.

    There should also be a menu item for the VC++ command prompt
    on the Start->Programs entry for VC++ 2010 Express.

    - Wayne

  • Friday, December 30, 2011 1:23 PM
     
     

    Thanks. I have entries in PATH for VC when I use the VS command prompt. Didn't think to check that. I was checking the Control Panel>Advanced System Settings>Enviroment Variables.

    I'm still having this problem. I might try debugging CL.exe unless someone has some ideas on what to try next?

  • Friday, December 30, 2011 4:36 PM
     
     
    Since you know how to open the command window and get
    environment variables configured for VC++, you should
    try a command line compile. It will probably be at the
    ..\VC\bin or ..\VC directory when you first open the
    console window. Using CD (Change Directory), navigate
    to the ,,\Projects directory where the *.cpp files are
    for one of your tests. e.g. -

    C:\Users\Code\Documents\Visual Studio 2010\Projects\test4\test4

    Then try a compile by entering:

    cl stdafx.cpp

    or

    cl test4.cpp

    If it works without errors, do a DIR of that directory
    and see if the *.obj file is there. (This is *not* where
    the obj files will normally be after a compile from the
    IDE.) For test4.cpp you may also have a .exe file, which
    you can try running.

    Some other considerations:

    Did you try a file Search of your *entire* hard drive
    for stdafx.obj and test4.obj? If not, you should do so
    in case there is a configuration problem with the VC++
    IDE where it specifies the output and intermediate
    directories.

    Also, which version of Windows are you using?

    I trust you have full administrator rights
    when you are running VC++? Also when you
    installed it?

    - Wayne
  • Friday, December 30, 2011 5:13 PM
     
     

    A picture is worth a thousand words, so:


    And I've tried a file search for stdafx and all that comes up are headers and the like, no object files.

    And I'm on Windows 7 with an admin account. VC++ was installed with admin rights.

    • Edited by Fyntun Friday, December 30, 2011 5:17 PM
    •  
  • Friday, December 30, 2011 7:41 PM
     
     
    Do you have another program (probably on the path)
    named cl.exe?

    From the command line again, what shows if you just type

    cl

    and Enter?

    You should see the equivalent of this (but for VC++ 2010):

    ...>cl
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86

    Copyright (C) Microsoft Corporation.  All rights reserved.

    usage: cl [ option... ] filename... [ /link linkoption... ]


    From the IDE, if you change the Project Properties for
    your test4 project, under the C++->General settings,
    change "Suppress Startup Banner" to No. The output
    window *should* show the compiler info such as above.
    e.g. -

    1>Compiling...
    1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
    1>Copyright (C) Microsoft Corporation.  All rights reserved.
    1>cl /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /doc"Debug\\" /W3 /c /ZI /TP ".\stdafx.cpp"
    1>   ".\test4.cpp"
    1>test4.cpp

    using Windows Explorer or equivalent, go to the ..\bin
    directory where cl.exe is installed and right click on
    it and display its properties.

    Note as well that the compiler actually consists of several parts.

    For example VC++ 2008 has:

    cl.exe  Microsoft C/C++ Compiler Driver

    c1.dll  Microsoft Visual C Compiler Front End
            (Note numeral one in name, not letter 'el'.)
    c1ast.dll  Microsoft Visual C Compiler Front End
    c1xx.dll   Microsoft Visual C++ Compiler Front End
    c1xxast.dll  Microsoft Visual C++ Compiler Front End
    c2.dll  Microsoft 386 Compiler Back End

    VC++ 2010 is similar.

    You must ensure that the needed dlls are there as well,
    and that there isn't a conflict with other dlls having
    the same name(s).

    - Wayne
  • Friday, December 30, 2011 7:50 PM
     
     
    One additional test. Change the name of your program to
    test4.c then right-click on it in the Solution Explorer
    window and select "Compile". See if the C compiler is
    invoked. As you can see from my last post, the C and
    C++ compilers are distinct. The cl.exe driver should
    invoke a different front end compiler.

    - Wayne

  • Friday, December 30, 2011 10:39 PM
     
     

    In the bin folder I have cl.exe, c1.dll, c1xx.dll and c2.dll.

    I get no output by simply running cl.exe with no parameters. I'm really starting to think this is a PATH issue because when I type SET, I get this:

    Path=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy;C:\Progra
    m Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\;C:\Program Files (x86)\M
    icrosoft Visual Studio 10.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studi
    o 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Mi
    crosoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 10.0\V
    C\VCPackages;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 T
    ools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;C:\Windows\system32
    ;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    ;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCo
    mmon\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x8
    6)\GnuWin32\bin;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Pr
    ogram Files (x86)\Notepad++;C:\Program Files\PellesC\Bin;C:\Program Files (x86)\
    QuickTime\QTSystem\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\;C
    :\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\;C:\Program Files (
    x86)\Microsoft Visual Studio 9.0\VC\lib\;

    Notice that Pelles C (a C compiler) is in there along with VS 9.0 (which I uninstalled...). While there shouldn't be any mixup with Pelles C since the file names are different and it's in the x64 Program Files, that VS 9.0 entry might be a problem? I can't see how that would be it though since I had the EXACT same problem with VC 2008 and that's the reason I switched to 2010.

    Changing the file name to test4.c and compiling does the same thing as compiling it as c++: nothing.

    Anything else I can try?

  • Saturday, December 31, 2011 12:30 AM
     
     
    I believe your prior command line tests were tried from
    one of the Project directories. Try running cl.exe again
    from the command line after changing to the ..\bin
    directory where it and the compiler dlls are located.

    As to path concerns, you can do selective testing from
    the command line with PATH changes. Open a VC++ command
    line tools console window. From that prompt, enter

    cmd

    and press Enter. This will open a *second* shell within the
    first. Any changes you make to the environment variables
    including PATH will alter only the environment for this
    secondary shell. When you type

    exit

    and Enter, you will leave this secondary shell and return
    to the first. Any changes you made to the environment
    variables within the second shell will be gone.

    You can create .bat files to facilitate the testing.

    - Wayne
  • Saturday, December 31, 2011 2:11 AM
     
     

    I'm assuming you meant like this?


    Edit: Forgot this one...


    And here is the directory files:

    Directory of C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

    12/30/2011  09:28 PM    <DIR>          .
    12/30/2011  09:28 PM    <DIR>          ..
    12/28/2011  11:33 AM    <DIR>          1033
    03/19/2010  02:02 PM           164,176 atlprov.dll
    03/19/2010  02:02 PM            77,648 bscmake.exe
    03/19/2010  02:02 PM           722,240 c1.dll
    03/19/2010  02:02 PM         2,436,424 c1xx.dll
    03/19/2010  02:02 PM         2,633,536 c2.dll
    03/19/2010  02:02 PM           145,728 cl.exe
    03/17/2010  11:39 PM               379 cl.exe.config
    03/18/2010  01:16 PM            31,048 cvtres.exe
    12/30/2011  09:28 PM                 0 dir.txt
    03/19/2010  02:02 PM            14,160 dumpbin.exe
    03/19/2010  02:02 PM            14,160 editbin.exe
    03/19/2010  02:02 PM            14,152 lib.exe
    03/19/2010  02:02 PM           852,296 link.exe
    03/17/2010  11:39 PM               377 link.exe.config
    03/19/2010  02:02 PM           397,120 ml.exe
    03/19/2010  02:02 PM            91,976 nmake.exe
    03/19/2010  02:02 PM            16,720 undname.exe
    11/15/2009  07:52 PM             4,062 vcvars32.bat
    03/19/2010  02:02 PM            36,688 xdcmake.exe
    03/17/2010  11:39 PM               373 xdcmake.exe.config
                  20 File(s)      7,653,263 bytes

     Directory of C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\1033

    12/28/2011  11:33 AM    <DIR>          .
    12/28/2011  11:33 AM    <DIR>          ..
    03/18/2010  09:11 PM            30,544 atlprovui.dll
    03/18/2010  09:11 PM            13,136 bscmakeui.dll
    03/18/2010  09:11 PM           408,904 clui.dll
    03/18/2010  01:16 PM            10,064 cvtresui.dll
    03/18/2010  09:11 PM            62,792 linkui.dll
    03/18/2010  09:11 PM            17,744 nmakeui.dll
                   6 File(s)        543,184 bytes

         Total Files Listed:
                  26 File(s)      8,196,447 bytes
                   5 Dir(s)  164,919,832,576 bytes free

    • Edited by Fyntun Saturday, December 31, 2011 2:29 AM
    •  
  • Saturday, December 31, 2011 2:13 AM
     
     

    Same reults.

    I'll try deleting the env variables for 9.0 and Pelles C and see what happens. It'll be a while before I can test it though.

    Thanks for everyones help so far. Hope we can get this figured out.

  • Saturday, December 31, 2011 11:32 PM
     
     

    Inside the VS command prompt I changed the PATH to:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCPackages;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;C:\Windows\system32;

    cl.exe still is producing no results at all.

    I guess this is just a lost cause.

  • Sunday, January 08, 2012 4:27 AM
     
     

    I'm guessing by the lack of responses that nobody has any idea about how to fix this.

    Can I legally debug cl.exe and post the results here?

  • Sunday, January 08, 2012 6:18 AM
     
     
    >Can I legally debug cl.exe and post the results here?

    My (unofficial) take on that is: No

    Read the EULA that came with the product.
    It will probably say something like this:

    "You also may not

    - reverse engineer, decompile or disassemble the software,
      except and only to the extent that applicable law
      expressly permits, despite this limitation;

    - publish the software for others to copy;"

    (Excerpted from the EULA for VC++ 2008 Express Edition.)

    I seriously doubt that there is anything intrinsically
    defective in cl.exe which might cause this - it appears
    more likely that it's something unusual about your
    system: conflicts, configuration issues, etc.

    You might try posting your problem here:

    Visual Studio Setup and Installation
    http://social.msdn.microsoft.com/Forums/en-US/vssetup/threads

    and here:

    Microsoft Connect
    Your feedback improving Microsoft products
    http://connect.microsoft.com/VisualStudio

    - Wayne
  • Sunday, January 08, 2012 4:52 PM
     
     


    Based on:

    You should be seeing the compiler version banner displayed.

    I think this is simply a bad install. You need to insert your VS2010 distribution CD and select the "Repair" option.

     

    • Proposed As Answer by Helen ZhaoModerator Monday, January 09, 2012 3:16 AM
    • Unproposed As Answer by Fyntun Tuesday, January 10, 2012 12:24 PM
    •  
  • Monday, January 09, 2012 3:31 AM
     
     
    >You should be seeing the compiler version banner displayed.

    As I illustrated in one of my posts.

    >I think this is simply a bad install.

    Perhaps. But the OP stated:

    >I have an error when I try to compile anything with
    >VC++ 2010 Express

    >I had the exact same problem with VC++ 2008 Express also.
    >So I finally decided to unistall 2008 and install 2010,
    >hoping the problem would be resolved. But I'm having the
    >same problem with 2010.

    While *two* bad installs is a possibility - especially if
    there's hardware problems - two "bad installs" of two
    different product versions, both exhibiting the same
    problem, diminishes the probability that it's "simply
    a bad install". Can't hurt to try a "Repair" though.

    - Wayne
  • Tuesday, January 10, 2012 12:23 PM
     
     

    It's not a bad install, as VC++ 2008 was reinstalled upwards of 20 times and 2010 has been reinstalled around 5 now. I even re-downloaded the ISO of 2010 and tried that with no luck.

    I can't think of anything out of the ordinary with my OS. I can use Code::Blocks+MinGW without problems. C# 2008 & 2010 both work fine. Pelles C works fine. The only thing that's giving me a problem is VC++.

    I guess I will post in the Setup and Installation forums and see if anyone can help. But this problem is not solved.

    Thanks to everyone for trying to help.

  • Tuesday, January 10, 2012 4:20 PM
     
     

    While *two* bad installs is a possibility - especially if
    there's hardware problems - two "bad installs" of two
    different product versions, both exhibiting the same
    problem, diminishes the probability that it's "simply
    a bad install". Can't hurt to try a "Repair" though.


    Yeah, I agree. One wonders about an OS problem, such as a fouled registry. I'm afraid we may have to recommend a clean OS install.
  • Tuesday, January 10, 2012 5:29 PM
     
     
    I will suggest again that you search your entire harddrive
    for any files which duplicate the names used by the
    compiler's components - including the DLLs. Pay special
    attention to the Windows and Windows\System32, etc,
    directories.

    One other suggestion:

    The command line being passed when you try to compile
    from the IDE has /ANALYZE set. But you don't have the
    Code Analysis DLLs installed. Turn that option off
    for your project. (I doubt very much that this is
    the problem though, since when you try to compile
    from the command line that option isn't used,)

    Just to clarify:

    This *is* the Express Edition of VC++ 2010 you're trying
    to use? If not, which edition is it?

    I'm surprised to see the /ANALYZE option being set in the
    command line being passed to cl.exe, as Code Analysis
    isn't included with the Express Edition.

    I note in the post of your path that you have:

    Path=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy;

    That's certainly not from the Express Edition.

    If you're trying to use the 2010 Express Edition *now*,
    did you have a trial version of the full product
    installed previously? If so, was it removed entirely
    before installing the Express Edition?

    - Wayne

  • Tuesday, January 10, 2012 11:54 PM
     
     

    I don't find anything useful or relevant when searching for cl.exe & friends. I do get some hits for the Windows\winsxs folder (clr_ilasm_exe_b03f5f7f11d50a3a_6.1.7600.16385_none_8fea3d83359e537c, exe_31bf3856ad364e35_6.1.7600.16385_none_cc12387f7062eb3b, exe_31bf3856ad364e35_6.1.7600.16385_none_6ff39cfbb8057a05... etc) but I don't think they are a problem.

    And I am not sure how to turn off the /ANALYZE option. I don't see it in the options but I could be missing it.

    And this *is* the Express edition. I've never even tried to install any other edition on this system. I'm not sure about the path references you mention, but it is the Express edition.

    But I can assure you that no other edition of VS or VC++ has ever been installed on this computer.