VS C++ 2010 LNK1123: failure during conversion to COFF

I am working on project and have this error how do I fix it ?

Someone suggested removing this #include "stdafx.h" ,but this creates more issues
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 // projone.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
double weight;
double height;
cout <<"Enter your weight in pounds :";
cin >> weight;
cout << endl;
cout <<"Enter your height in inches :";
cin >> height;
cout << endl;
cout <<"Weight is given by " << weight << endl;
cout <<"Height is given by " << height << endl;
double bmi = ( weight * 703 ) / ( height * height );
if (bmi < 18.5)
cout << " Underweight " << endl;
else if(bmi < 25)
cout << " Normal " << endl;
else if(bmi < 30)
cout << " Overweight " << endl;
else 
cout << " Obese " << endl; 
return 0;
}



ERROR: 1>------ Build started: Project: projone, Configuration: Debug Win32 ------ 1> projone.cpp 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 never said remove it, I told you to create the correct type of project. It looks like you have not created a console application project because if you had then you wouldnt have that include.
Seems to work OK without the stdafx.h. Here's your code without that header include.

http://ideone.com/MxPWd9

Have you tried cutting and pasting your code into a completely new Console project?

You are creating the wrong type of project, create a console project and copy/paste the code (without the stdafx include) and recompile. You were already helped regarding this issue in this thread: http://www.cplusplus.com/forum/beginner/136020/#msg724625

I created a Win32 console application ,what was I suppose to create ?
http://stackoverflow.com/questions/10888391/error-link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-inval

Nothing to do with the type of project you create.

Contrary to (apparently) popular belief, precompiled headers may be used with console projects.

I created a Win32 console application ,what was I suppose to create ?


If this is the case then check out my post for a user with similar problem in the past: http://www.cplusplus.com/forum/beginner/132059/#msg710980
Topic archived. No new replies allowed.