Click to See Complete Forum and Search --> : apress books source code won't compile
hedron
August 4th, 2008, 03:54 PM
I have this book, "The Definitive guide to Linux Network Programming" and the source code won't compile. I check it over to make sure there's not typo's but I still get errors. Maybe I'm not compiling them right? But I'm not the only one who gets errors. The only thing is that I might be using a different version of gcc? The code can be found HERE (http://www.apress.com/book/downloadfile/1758)
I'm curious if anyone knows if there has been a solution to this, as I haven't got anything back from their support nor does google know. The only thing I can think of is troubleshooting every piece of code in the book, and when you're just learning, that's not really something I want to do.
S_M_A
August 4th, 2008, 05:10 PM
Maybe book is old (new? I'm not really a linux guy). Compilation of 32270201.c using gcc 4.1 gave (no flags, just gcc 32270201.c)32270201.c: In function 'main':
32270201.c:18: warning: incompatible implicit declaration of built-in function 'exit'
32270201.c:27: warning: incompatible implicit declaration of built-in function 'exit'
32270201.c:39: warning: incompatible implicit declaration of built-in function 'bzero'
32270201.c:53: warning: incompatible implicit declaration of built-in function 'exit'
32270201.c:62: warning: incompatible implicit declaration of built-in function 'exit'
32270201.c:81: warning: incompatible implicit declaration of built-in function 'exit'
32270201.c:87: warning: incompatible implicit declaration of built-in function 'strlen'so if I get the same result as you get it's really "only" warnings.
Grep-ing shows that exit is declared in stdlib.h, bzero & strlen are declared in string.h so add includes for those files.
Hopefully this takes you a bit forward. If you encounter any similar issues "just" grep for the missing declaration. On a Debian system that is (example):
grep -w exit /usr/include/*.h
hedron
August 5th, 2008, 10:22 PM
Hopefully this takes you a bit forward. If you encounter any similar issues "just" grep for the missing declaration. On a Debian system that is (example):
grep -w exit /usr/include/*.h
Yea, thanks! That did the trick.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.