Help External Link Error

I am using Microsoft Visual C++ Studio 2010 as my ide and compiler. Its giving me the following error codes and my code is posted below for reference. The program is meant to convert an integer into a roman numeral.

ERROR CODE
1>------ Build started: Project: hw01_9__11, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
1>C:\Users\Thomas\documents\visual studio 2010\Projects\hw01_9__11\Debug\hw01_9__11.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>

using namespace std;

//Function used to represent interger a as a Roman Numeral string
/*string romanNumeral (int a)
{
//numeral is intiliazed as a string object to store the result to be returned.
string numeral;
// Checks to see if the integer is positive
if (a > 0)
{
//Loop is used to add M to the end of the string and subtract 1000 from the passed in integer
while (a >= 1000)
{
numeral.append("M");
a = a - 1000;
}
//Loop is used to add CM to the end of the string and subtract 900 from the passed in integer
while (a >= 900)
{
numeral.append("CM");
a = a-900;
}
//Loop is used to add d to the end of the string and subtract 500 from the passed in integer
while (a >= 500)
{
numeral.append("D");
a = a- 500;
}
//Loop is used to add CD to the end of the string and subtract 400 from the passed in integer
while (a >= 400)
{
numeral.append("CD");
a = a-400;
}
//Loop is used to add C to the end of the string and subtract 100 from the passed in integer
while (a >= 100)
{
numeral.append("C")
a = a - 100;
}
//Loop is used to add XC to the end of the string and subtract 90 from the passed in integer
while (a >= 90)
{
numeral.append("XC");
a = a - 90;
}
//Loop is used to add L to the end of the string and subtract 50 from the passed in integer
while (a >= 50)
{
numeral.append("L");
a = a - 50;
}
//Loop is used to add XL to the end of the string and subtract 40 from the passed in integer
while (a >= 40)
{
numeral.append("XL");
a = a - 40;
}
//Loop is used to add X to the end of the string and subtract 10 from the passed in integer
while (a >= 10)
{
numeral.append("X");
a = a - 10;
}
//Loop is used to add IX to the end of the string and subtract 9 from the passed in integer
while (a >= 9)
{
numeral.append("IX");
a = a - 9;
}
//Loop is used to add V to the end of the string and subtract 5 from the passed in integer
while (a >= 5)
{
numeral.append("V");
a = a - 5;
}
//Loop is used to add IV to the end of the string and subtract 4 from the passed in integer
while (a >= 4)
{
numeral.append("IV");
a = a - 4;
}
//Loop is used to add I to the end of the string and subtract 1 from the passed in integer
while (a >= 1)
{
numeral.append("I");
a = a - 1;
}
}
else
{
return "Invalid entry";
}
return numeral;
}
*/
int main()
{
//Creates an integer to store the number from the file
int toad = 0;
// Creates a stream to open integer file
ifstream mario("integers.txt");
// Checks to see if file exists
if (!mario)
{
cerr << "File does not exist\n";
return(1);
}
//Iterates through the stream while it still returns anything but null
while (mario >> toad)
{
cout << toad << ":\t" << romanNumeral(toad);
}
}
Hello, thoythoy.

It appears as though your project is set-up to accept the WinMain( ) entry-point, not main( ). You can fix this by following these steps:

1) Navigate to: Project >> [Project-Name] Properties.
2) Expand the Configuration Properties node, followed by the expansion of the Linker node.
3) Click on the Advanced node.
4) At the top of the window, select All configurations from the Configuration drop-down list.
5) Locate the Entry Point field within the list beneath.
6) Rename the value of this field to main.
7) Press Apply then OK.
Last edited on
Yeah.......i did exactly that and no avail
OK then, try this:

1) Navigate to: Project >> [Project-Name] Properties.
2) At the top of the window, select All configurations from the Configuration drop-down list.
3) Expand the Configuration Properties node, followed by the expansion of the Linker node.
4) Click on the System node.
5) Find the SubSystem field within the list to the right.
6) Select the Console list item.
7) Press Apply then OK.
Still nothing.....listed below is the updated error message with no change to existing code above


1>------ Build started: Project: hw01_9__11, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _main
1>C:\Users\Thomas\documents\visual studio 2010\Projects\hw01_9__11\Debug\hw01_9__11.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Topic archived. No new replies allowed.