LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   gcc compile error? (http://www.linuxquestions.org/questions/programming-9/gcc-compile-error-441658/)

wampire 05-04-2006 04:05 PM

gcc compile error?
 
Hello everybody
I have a problem about c compiling.Program has a few header files ,string.h,stdlib.h,libnet.h,ncurses.h ...
and I compiled this program with gcc but I takes a few error like this.I cant understand where the problem is...help me

linux:/home/wampire/programlama/c/tcp-ip # gcc gopack.c -o gopack /usr/lib/libnet.a -lncurses -lstring
gopack.c: In function ‘main’:
gopack.c:79: warning: pointer targets in passing argument 2 of ‘libnet_name2addr4’ differ in signedness
gopack.c:84: warning: pointer targets in passing argument 2 of ‘libnet_name2addr4’ differ in signedness
gopack.c:202:2: warning: no newline at end of file
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: cannot open output file gopack: Is a directory
collect2: ld returned 1 exit status

burntfuse 05-04-2006 04:52 PM

If it's not too large, could you post the source file? I could be completely wrong, but it looks like you're trying to pass a pointer to a signed int to libnet_name2addr4 when it requires an unsigned int, or something similar (could also be the other way around). It also seems that the file you're trying to output it to (gopack) is a directory - just give the binary a different name or rename the folder.

Digital Surgeon 05-06-2006 06:17 PM

to get a good response type the code then the error msg you get, you have a lot of room on the post

paulsm4 05-06-2006 09:05 PM

1. These are not errors, they're merely warnings:
Quote:

inux:/home/wampire/programlama/c/tcp-ip # gcc gopack.c -o gopack /usr/lib/libnet.a -lncurses -lstring
gopack.c: In function ‘main’:
gopack.c:79: warning: pointer targets in passing argument 2 of ‘libnet_name2addr4’ differ in signedness
gopack.c:84: warning: pointer targets in passing argument 2 of ‘libnet_name2addr4’ differ in signedness
<= TO UNDERSTAND THESE, YOU'D HAVE TO POST THE RELEVANT PARTS OF THE SOURE
2. This is just a warning, too. To fix it, simply add a blank line after the last source line in CODEgopack.c. Believe it or not, it's a legitimate warning (although it's very unlikely it would ever cause you a real problem):
Quote:

CODEgopack.c:202:2: warning: no newline at end of file
3. This is a real, bona fide error:
Quote:

linux:/home/wampire/programlama/c/tcp-ip # gcc gopack.c -o gopack /usr/lib/libnet.a -lncurses -lstring
...
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: cannot open output file gopack: Is a directory
collect2: ld returned 1 exit status
It looks like you've got a directory named "gopack" where the linker wants to create a new program file called "gopack". You can remove the directory, write the file someplace else, or rename the executable (e.g. "-o something_else").

'Hope that helps .. PSM

PS:
You seem to be logged in and compiling as "root" (the "#" prompt). Generally *not* a good practice...


All times are GMT -5. The time now is 09:44 PM.