Problem in C++ in Visual Studio 2010 Express
Jun 18, 2014 at 5:25pm UTC
Below i my code I am unsure of why an error is coming up and I dont know how to fix it. In C++ Visual Studio
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 30 31 32 33 34
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
double height, weight;
double bmi;
cout<<"Enter height in inches:" ;
cin>>height;
cout<<"Weight in pounds: " ;
cin>>weight;
cout<<"Height=" <<height<<"Weight=" <<weight<<endl;
bmi=( weight * 703 ) / ( height * height );
cout<<"BMI is: " <<bmi<<endl;
if (bmi<18.5)
cout<<"Underweight" <<endl;
else if (bmi>=18.5 && bmi<25)
cout<<"Normal" <<endl;
else if (bmi>=25 && bmi<30)
cout<<"Överweight" <<endl;
else
cout<<"Obese" ;
system("pause" );
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
ERROR: 1>------ Build started: Project: hjl, Configuration: Debug Win32 ------
1> stdafx.cpp
1> hjl.cpp
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
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 ==========
Jun 18, 2014 at 5:28pm UTC
well... you have two entry points.
Jun 18, 2014 at 6:30pm UTC
You have 2 main methods, you can only have 1 main method in C++ and a lot of OOP langauges.
Jun 18, 2014 at 6:34pm UTC
you can only have 1 main method in C++ and a lot of OOP langauges.
why limit it to just oop? i have never seen a language that will let you do that, including c and assembly. why would you try to enter a house through two doors?
Topic archived. No new replies allowed.