How To Build a Compile Environment in Windows??

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
schhaozi

How To Build a Compile Environment in Windows??

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

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

Post 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 ;)
Post Reply