Error: collect2: ld returned 1 exit status

N

Navaneet

Hi,
I am building a application on linux. I am getting an error which
relates to undefined reference to a function. I had build same on
other platform, no error comes.
Here is whole error message ...

make: Warning: File `linux_i32' has modification time 9.5e+02 s in the
future
gcc -Dlinux_i32 -fPIC -I/usr/local/actel/actel-dinkum/include -
D_ALT_NS=1 -t -mt -o
linux_i32/globchat /home/ruchira/windu5/lib.linux_i32/wincrt0.o /home/
ruchira/windu5/
lib.linux_i32/wu.o linux_i32/about.o linux_i32/dispatch.o linux_i32/
globchat.o linux_i
32/init.o linux_i32/misc.o linux_i32/winmain.o linux_i32/def.o -L/home/
ruchira/windu5/
lib.linux_i32 -lwinsock50 -L/home/ruchira/windu5/lib.linux_i32 -lgdi50
-luser50 -lkern
el50 -lprnt50 -L/usr/X11R6/lib -lXm -L/usr/X11R6/lib -lXt -lm -ldl -
lnsl -lpthread
linux_i32/globchat.o(.text+0x1ea): In function `MsgCreate':
: undefined reference to `EnumProtocolsA'
linux_i32/globchat.o(.text+0x248): In function `MsgCreate':
: undefined reference to `EnumProtocolsA'
/usr/bin/ld: link errors found, deleting executable `linux_i32/
globchat'
/usr/bin/ld: mode elf_i386
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/3.4.3/crtbegin.o
/home/ruchira/windu5/lib.linux_i32/wincrt0.o
/home/ruchira/windu5/lib.linux_i32/wu.o
linux_i32/about.o
linux_i32/dispatch.o
linux_i32/globchat.o
linux_i32/init.o
linux_i32/misc.o
linux_i32/winmain.o
linux_i32/def.o
-lwinsock50 (/home/ruchira/windu5/lib.linux_i32/libwinsock50.so)
-lgdi50 (/home/ruchira/windu5/lib.linux_i32/libgdi50.so)
-luser50 (/home/ruchira/windu5/lib.linux_i32/libuser50.so)
-lkernel50 (/home/ruchira/windu5/lib.linux_i32/libkernel50.so)
-lprnt50 (/home/ruchira/windu5/lib.linux_i32/libprnt50.so)
-lXm (/usr/X11R6/lib/libXm.so)
-lXt (/usr/X11R6/lib/libXt.so)
-lm (/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../libm.so)
-ldl (/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../libdl.so)
-lnsl (/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../libnsl.so)
/lib/libpthread.so.0
-lgcc_s (/usr/lib/gcc/i386-redhat-linux/3.4.3/libgcc_s.so)
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
-lgcc_s (/usr/lib/gcc/i386-redhat-linux/3.4.3/libgcc_s.so)
/usr/lib/gcc/i386-redhat-linux/3.4.3/crtend.o
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crtn.o
collect2: ld returned 1 exit status
make: *** [linux_i32/globchat] Error 1

Can anybody say why it comes and what the solutions?
Thanks,
Navneet
 
L

Lew Pitcher

Hi,
I am building a application on linux. I am getting an error which
relates to undefined reference to a function. I had build same on
other platform, no error comes.
Here is whole error message ... [snip]
collect2: ld returned 1 exit status
make: *** [linux_i32/globchat] Error 1

Can anybody say why it comes and what the solutions?

Probably. But not here. Try comp.os.linux.development.apps or
comp.os.linux.misc
Here in comp.lang.c, we discuss the proper use of the C programming
language, not failure of linkage editors to properly link programs.

<off_clc_topic>
Hint: take another look at that output, especially around the lines
that reference globchat.o. You'll find your problem (but not your
solution) there.
</off_clc_topic>
 
J

jacob navia

Navaneet wrote:
[snip]
linux_i32/globchat.o(.text+0x1ea): In function `MsgCreate':
: undefined reference to `EnumProtocolsA'
linux_i32/globchat.o(.text+0x248): In function `MsgCreate':
: undefined reference to `EnumProtocolsA' [snip]
Can anybody say why it comes and what the solutions?
Thanks,
Navneet


Can't you read?
In your function "MsgCreate" you are referencing
a library function called "EnumProtocolsA"

This function is not defined in your source code
and not in the libraries you provided. The linker
tells you:

I can't link this program because I am missing this
references"

Solution:

Provide a definition for EnumProtocolsA.

<Hint>

This is a windows function defined in the Winsock
library. Since you are compiling under linux
this function doesn't exist.
</Hint>

<Surprise!>
Compiling network code without caring to look at what it
does doesn't work when you go from windows to linux.
</Surprise>


<Solution>
Pay me an unspecified amount of money to do your job.
I'll fix it for you
:)
</Solution>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top