0
/* QuadircEquation.c */
#include <stdio.h>
#include <math.h>

int QuadircEquation(void) {
    double root1, root2, discriminant, a, b, c;
    discriminant = b * b - 4 * a * c;
    root1 = (-b + sqrt(discriminant))/(2*a);
    root2 = (-b - sqrt(discriminant))/(2*a);

    printf("Enter coeficients a, b, and c: ");
    scanf("%lf %lf %lf", &a, &b, &c);

    if (discriminant = 0)
        printf("%lf \n", root1);

    else if (discriminant > 0)
        printf("%lf %lf", root1, root2);

    else 
        printf("There is no root");

    printf("\n");


    return 0;
}

This is in C. It returns with this error: "undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status"

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
  • 1
    It's telling you the problem - where's your main() ? – UKMonkey Oct 18 '16 at 16:22
  • The dup question barely mentions `WinMain` which is an OS specific version of `main` and can look like this `int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)` – Weather Vane Oct 18 '16 at 16:29
  • @sodejonne2. Please do not post questions that have obvious answers from 30 seconds of Googling. In general, make a habit of pasting your exact error into your search engine and avoid wasting everyone's time, including your own. The duplicate question I linked to is the first thing that came up when I pasted your error into Google. – Mad Physicist Oct 18 '16 at 16:30
  • So if it is that simple, what should I do? I tried google, but for the first time in human history, it didn´t work after 1 hour... – sodejonne2 Oct 18 '16 at 16:32
  • @sodejonne2 You probably Googled the wrong error. If you'd looked up what `ld returned 1 exit status` means, you'd realize that it's a generic error meaning that the linker had an error. The actual error was `undefined reference to `WinMain@16`, which is what you should've Googled. I mean, it was right there, so I'm not sure how you missed it. I also find it hard to believe that you wouldn't find anything useful in an hour of using Google. – Random Davis Oct 19 '16 at 18:14

0 Answers0