"Game Over" program build fail?

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
Are you actually adding the file to the project? VC can be a little deceptive when it comes to editing files in the IDE.
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;
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.
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.
Just tried both of those, still no luck :/
Really need more help here guys.
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.