Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compilation error

1 view
Skip to first unread message

zak100

unread,
Jul 21, 2009, 6:36:05 AM7/21/09
to Help-gp...@gnu.org

Hi,
I am trying to compile a program but I am getting following error:

D:\NASMPR~1\mz2>gcc main1.c
E:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):main.c:(.tex
t+0x104): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

The program is given below:

#define WHITE_TXT 0x07
void K_clear_screen();
unsigned int K_printf(char *message, unsigned int line);
//void update_cursor(int row, int col);

K_main(){
K_clear_screen();
K_printf("Hi\n How is this for a starter OS?",0);
}

void K_clear_screen() {
char *vidmem=(char*) 0xb8000;
unsigned int i=0;
while(i<(80*25*2))
{
vidmem[i]=' ';
i++;
vidmem[i]=WHITE_TXT;
}
}

unsigned int K_printf(char *message, unsigned int line){
char *vidmem=(char *) 0xb8000;
unsigned int i=0;
i=(line*80*2);
while(*message!=0)
{
if(*message=='\n')
{
line++;
i=(line*80*2);
*message++;
}

else {
vidmem[i]=*message;
*message++;
i++;
vidmem[i]=WHITE_TXT;
i++;
}
}
return 1;
}

Can somebody plz help me with this.

Zulfi.
--
View this message in context: http://www.nabble.com/Compilation-error-tp24585311p24585311.html
Sent from the gcc - Gnu Help List mailing list archive at Nabble.com.

Thomas Maeder

unread,
Jul 21, 2009, 11:36:22 AM7/21/09
to
zak100 <zulf...@yahoo.com> writes:

> Can somebody plz help me with this.

Please next time post your code in human readable form.

From what I can tell from the unreadable form, it seems to lack a
main() function.

0 new messages