[RESOLVED] Failure during conversion to COFF
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: [RESOLVED] Failure during conversion to COFF

  1. #1
    Join Date
    Apr 2009
    Posts
    82

    [RESOLVED] Failure during conversion to COFF

    I encountered error when compiling a simple project on my PC. However, other PC is working fine. Wonder what is missing from my PC?

    1>------ Rebuild All started: Project: Test01, Configuration: Debug Win32 ------
    1>Build started 12/10/2013 5:30:01 PM.
    1>_PrepareForClean:
    1> Deleting file "Debug\Test01.lastbuildstate".
    1>InitializeBuildStatus:
    1> Touching "Debug\Test01.unsuccessfulbuild".
    1>ClCompile:
    1> stdafx.cpp
    1> Test01.cpp
    1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:03.70
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Code:
    int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    	int nRetCode = 0;
    
    	HMODULE hModule = ::GetModuleHandle(NULL);
    
    	if (hModule != NULL)
    	{
    		// initialize MFC and print and error on failure
    		if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
    		{
    			// TODO: change error code to suit your needs
    			_tprintf(_T("Fatal Error: MFC initialization failed\n"));
    			nRetCode = 1;
    		}
    		else
    		{
    			// TODO: code your application's behavior here.
    			printf("hello world");
    		}
    	}
    	else
    	{
    		// TODO: change error code to suit your needs
    		_tprintf(_T("Fatal Error: GetModuleHandle failed\n"));
    		nRetCode = 1;
    	}
    
    	return nRetCode;
    }

  2. #2
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,592

    Re: Failure during conversion to COFF

    Hi!

    This is a known issue. If "rebuild all" does not help you are likely suffering from the effects of the system picking up the wrong cvtres.exe, maybe from an earlier installation of the .NET framework.

    Search your system for "cvtres.exe" and try renaming each file you find (one at a time) until the problem is resolved. You can rename it to anything other than cvtres, the purpose is just to make sure the compiler can no longer find the file in question.
    Nobody cares how it works as long as it works

  3. #3
    Join Date
    Apr 2009
    Posts
    82

    Re: Failure during conversion to COFF

    When I tried to use to windows 7 search engine, I couldn't locate the file.
    But manage to find it at path below by manually open the folder
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe
    Still can't resolve after rebuilding.
    COuld it be due to my .NET framework problem? Which version should I use? Wish to download and reinstall to try out.

  4. #4
    Join Date
    Apr 2009
    Posts
    82

    Re: [RESOLVED] Failure during conversion to COFF

    Managed to resolve this after downgrading .NET framework from 4.5 to 4.0.

  5. #5
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,592

    Re: [RESOLVED] Failure during conversion to COFF

    Glad to hear you solved it. The Windows 7 search feature has serious problems, that is why you had trouble finding the cvtres files.
    Nobody cares how it works as long as it works

  6. #6
    Join Date
    Feb 2014
    Posts
    1

    Re: [RESOLVED] Failure during conversion to COFF

    Thanks! You have helped a TOTAL noob get his very first (Hello world) program working, after banging his head against a brick one for a few days!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center