473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error: collect2: ld returned 1 exit status

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

Sep 12 '07 #1
2 18215
On Sep 12, 11:36 am, Navaneet <tonavan...@gmail.comwrote:
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>

Sep 12 '07 #2
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>
Sep 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Steve Holden | last post by:
Does anyone know the workaround for this error, encountered when trying to build PIL 1.1.4 from source under cygwin (Python 2.3.3)? running build_ext building '_imaging' extension gcc...
1
by: Lu | last post by:
$ cat main.c extern void asm_exit(int); int main(int argc,char *argv) { asm_exit(0); } $ cat asm_exit.asm ; exit() by assembly: void asm_exit(int status) ; assemble: nasm -f elf asm_exit.asm
5
by: Patrick Coleman | last post by:
Hi, This may seem to be a basic question, but I keep getting the following error: main.cc:93: undefined reference to `AT_UrlParser::AT_UrlParser(char const*, std::basic_string<char,...
10
by: siroregano | last post by:
Hello- I've got a nice C program written that uses libsndfile (#include <sndfile.h>) to convert my raw data into a properly-formatted wav file. The program is composed of a single .c file that...
3
by: baur79 | last post by:
# python configure.py -q /usr/lib/qt-3.3/ This is the GPL version of PyQt 3.16 (licensed under the GNU General Public License) for Python 2.4.2 on linux2. Type 'L' to view the license. Type...
2
by: zapr | last post by:
I am trying to compile on Mac OS X 10.4 my C program. I am stuck at the link phase where I get (gcc 4.01): $ gcc -s -Os -Wall -fprofile-arcs -fpack-struct -fno-common -ffast-math -ffloat-store...
8
by: Joshua Moore | last post by:
/* Hi, I was hoping someone could help me with this problem. I did my work and worked my way through the usual compiler messages, but I have run against some problem I can't identify. The compiler...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
1
by: Anish Chapagain | last post by:
//Info: resolving _optind by linking to __imp__optind (auto-import) //Info: resolving _optarg by linking to __imp__optarg (auto-import) //collect2: ld returned 1 exit status //error: command 'gcc'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.