"Game Over" program build fail?

Jan 19, 2013 at 3:01am
Hello,

I just bought a book on game programming with c++ and one of the first things you do is make the "Game Over" console program. I'm using Microsoft Visual c++ 2012 Express. I follow what the book says and type in the code for the program. The code:

//Game Over
//A first C++ program

#include <iostream>

int main()
{
std::cout << "Game Over" << std::endl;
return 0;
}

After I type that in, I click the "debug" tab and then click "build solution" and I end up getting this error:

1>------ Build started: Project: game_over, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tried making a whole new file and typing the code in again and it still does this. I'm using the Win32 Console Application template as that it was the book told me to use. Can anyone help me as to why it's failing?

Thanks,
~mdbay

Update: I fixed the problem. I just had to install SP1 for VC.
Last edited on Jan 20, 2013 at 7:51pm
Jan 19, 2013 at 5:01am
Are you actually adding the file to the project? VC can be a little deceptive when it comes to editing files in the IDE.
Jan 19, 2013 at 4:31pm
I have the exact same book. I am on linux, and didn't use this program, I went straight to 'Game Over 2.0' because I don't like using std::cout <<.

I went to using namespace std;
Jan 20, 2013 at 12:53am
I'm pretty sure I'm adding it to the project. But can you explain how to do that or check encase I'm not? Sorry, kinda new to all this.
Jan 20, 2013 at 2:10am
The easiest way is to press ctrl+shift+A, this adds either a new or existing item to your project.

Try adding a new .cpp file to your project, then copy and paste your code. After that try compiling it again.

If that doesn't work, try creating an empty project, then doing the steps provided above.

Heres the deal, Win32 Console is different from console, and a Win32 application. When you set the compiler up, it looks for a specific memory address which matches the signature of the main function (more specifically a call style). So you have to be somewhat accurate when describing these things to VC++. Its easiest to just open an empty project, and add your stuff as you go.
Jan 20, 2013 at 5:10am
Just tried both of those, still no luck :/
Jan 20, 2013 at 4:51pm
Really need more help here guys.
Jan 21, 2013 at 4:04pm
closed account (L1AkoG1T)
I found this link:
http://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c
It might help...
Topic archived. No new replies allowed.