Friday, July 31, 2009

C++ help please?

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%26lt;graphics.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;DOS.h%26gt;


#include%26lt;iostream.h%26gt;


#include%26lt;stdlib.h%26gt;


#include%26lt;stdio.h%26gt;








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(%26amp;gd,%26amp;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()-15...


gotoxy(21,17);


cout%26lt;%26lt;"Player 1:";


gotoxy(31,17);





cin%26gt;%26gt;p1;


gotoxy(21,19);


cout%26lt;%26lt;"player 2:";


gotoxy(31,19);


cin%26gt;%26gt;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();}

C++ help please?
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..."
Reply:Text from vmlinux.org


http://www.vmlinux.org/~jakov/community....





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.
Reply: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.
Reply:In you main routine you calling a function





void main()


{gamesequence();}





which is not defined or protoyped before main()
Reply: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.


No comments:

Post a Comment