Question:
c++ help please?
2007-06-14 10:01:43 UTC
i was making a a title on my program "tictactoe", when i run the program it was okey but when i compile it the error states that:

linker error: undefined symbol _main in module c0.ASM

here is my program:

#include
#include
#include
#include
#include
#include


void gdriver(void);
void title(void);
void name(void);

char p1[16],p2[16];
void main()
{gamesequence();}
void gdriver(void)
{int gd=DETECT,gm;
initgraph(&gd,&gm,"c:/tc3/BGI");
}

void name()
{title();
setcolor(BLUE);
settextstyle(2,0,6);
outtextxy(205,180,"Please enter your names:");
setfillstyle(SOLID_FILL,RED);
bar(150,250,getmaxx()-150,getmaxy()-150);
gotoxy(21,17);
cout<<"Player 1:";
gotoxy(31,17);

cin>>p1;
gotoxy(21,19);
cout<<"player 2:";
gotoxy(31,19);
cin>>p2;
}


void title(void)
{clrscr();
char msg[50];
setcolor(4);
rectangle(628,200,0,0);
setcolor(3);
settextstyle(SANS_SERIF_FONT, HORIZ_DIR,9);
sprintf(msg,"TICTACTOE",9);
outtextxy(95,30,msg);
getch();
closegraph();}
Five answers:
Ritu M
2007-06-14 10:16:36 UTC
Do you have the gamesequence() function written somewhere? Or is it part of one of the libraries?



Source [1]:

UNDEFINED SYMBOL: '_main' IN MODULE C0.ASM

Every C program must contain a function called main().

This is the first function executed in your program.

The function name must be all in lower case. If your

program does not have one, create one. If you are

using multiple source files, the file that contains

the function main() must be one of the files listed in

the project.

Note that an underscore character '_' is prepended to

all external Turbo C++ symbols.

In addition to an absent, misspelled or mis-cased

symbol main, there are two additional common causes:

The "generate underbars" option is disabled.

The Pascal calling Convention rather than the C

calling convention is selected.



Source [2]:

Make sure that your program has a main() function defined. Secondly,

make sure that you're using the correct project setting (i.e., Console

Application). Then recompile your code and see if that solves the

problem.



Source [3]:

void main() is not legal in C++ but is legal in C.
Hawk
2007-06-14 17:10:05 UTC
Text from vmlinux.org

http://www.vmlinux.org/~jakov/community.borland.com/15688.html



UNDEFINED SYMBOL: '_main' IN MODULE C0.ASM

Every C program must contain a function called main().

This is the first function executed in your program.

The function name must be all in lower case. If your

program does not have one, create one. If you are

using multiple source files, the file that contains

the function main() must be one of the files listed in

the project.

Note that an underscore character '_' is prepended to

all external Turbo C++ symbols.

In addition to an absent, misspelled or mis-cased

symbol main, there are two additional common causes:

The "generate underbars" option is disabled.

The Pascal calling Convention rather than the C

calling convention is selected.
ping_anand
2007-06-14 17:14:07 UTC
UNDEFINED SYMBOL: '_main' IN MODULE C0.ASM:



Every C program must contain a function called main(). This is the first function executed in your program. The function name must be all in lower case. If your program does not have one, create one. If you are using multiple source files, the file that contains the function main() must be one of the files listed in the project. Note that an underscore character '_' is prepended to all external Turbo C++ symbols. In addition to an absent, misspelled or mis-cased symbol main, there are two additional common causes: The "generate underbars" option is disabled. The Pascal calling Convention rather than the C calling convention is selected.



From the code I think you are getting that error possibly because of this reason:



"...If you are using multiple source files, the file that contains the function main() must be one of the files listed in the project..."
Luciano K
2007-06-14 17:10:29 UTC
try gamedev.net. there is a free chatroom there where u can get help from a lot of people. you could even post ur code on the live chatroom and they will help you.
KACH
2007-06-14 20:33:50 UTC
In you main routine you calling a function



void main()

{gamesequence();}



which is not defined or protoyped before main()


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...