c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libmingw32.a(main.o):main.c:(.tex
t+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
This is my source code and is there when I am trying to comlpile a program. This is the command that I am typing in C:\\Users\\Kyle Mitchell\\Documents>gcc program09.c -o program09.exe
#include <stdio.h>
void displayInstructions(void);
float getRadius(void);
float calculateCircumference(float);
void displayResults(float);
int mian(void)
{
float radius;
float circumference;
displayInstructions();
radius = getRadius();
circumference = calculateCircumference(radius);
displayResults(circumference);
return 0;
}
void displayInstructions(void)
{
printf("This program will calculate the circumference of a circle.\n");
}
float getRadius(void)
{
float radius;
printf("Please enter the raidus:\n");
printf("> ");
scanf("%f", &radius);
return radius;
}
float calculateCircumference(float radius)
{
float PI = 3.1415;
return PI * radius * 2;
}
void displayResults(float circumference)
{
printf("\n\n\n\n\n");
printf("==============================\n");
printf("= PROGRAM RESULTS =\n");
printf("= circumference: %.2f\n", circumference);
}
Your program must contain a main or a WinMain in order to be a valid windows program. You have a mian. It complains about WinMain because that is the normal way for a windows program. However, mingw should be fine if you just spell main correctly.
用main
代替mian
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.