Page 1 of 1

How To Build a Compile Environment in Windows??

Posted: Sun Jun 06, 2004 10:08 am
by schhaozi
Recently,I want to build a compile Environment in Windows using Cygwin.But Some problems occur when I write a simple c program.Follow is my program:
int main()
{
}
gcc -c test.c
ld -o test -Ttext 0x0 -e main test.o
error : Undefine reference '_alloca' and '_main'
Then follow some guide,I change the program as follow:
int Init()
{
}
gcc -c test.c
ld -o test -Ttext 0x0 -e _Init test.o
objcopy -R .note -R .comment -S -O binary test test.bin
No error occurs.but when I view the bin files,I discover that there are 4k byte 0 added.Are there added by the Window System or not??How to delete them when compiling.

Re:How To Build a Compile Environment in Windows??

Posted: Sun Jun 06, 2004 3:47 pm
by Pype.Clicker
i strongly suggest you read the Bare Bones & friends section in the http://www.osdev.org/osfaq2/ . Checking the information about -ffreestanding in "info gcc" might also help alot ;)