0

This program is being compiled successfully but giving following linking error :

undefined symbol _main in module c0.ASM

My program is following :

#include<stdio.h>
#include<conio.h>

int main()
{
char input[] = "hello sumit kumar";
char *a;
a = input;
printf("%s", a);
getch();
return 0;
}

`

Girjesh Shakya
  • 21
  • 1
  • 1
  • 4
  • Remove the #include and replace getch to getchar. – Puvanarajan Nov 04 '14 at 06:48
  • This is a linker error, and depends on how you compile and link the program. The C code itself is correct, assuming you are using Windows. – Thomas Padron-McCarthy Nov 04 '14 at 06:57
  • 1
    Since the error seems not to be in the code you have shown, you need to give details about how you build and link the project. What environment, such as Visual Studio or GCC, are you using? What kind of project have you created? How do you build it? – Thomas Padron-McCarthy Nov 04 '14 at 07:21

1 Answers1

-1

Assuming you are on linux: The following program would work.

#include<stdio.h>

int main()
{
    char input[] = "hello sumit kumar"; //Removed stray marks at the beginning
    char *a;
    a = input;
    printf("%s", a);
    getchar();   //To use getch() have to include <curses.h> file
    return 0; //Removed stray marks at the end
}
Santosh A
  • 5,173
  • 27
  • 37