Topic: Error - Type 'socket' not defined yet.


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Mon, 23 May 1994 08:47:09 GMT
Raw View
bharat@ccvax.ucd.ie writes:

>int socket (int, int, int);
[...]
>ld: Undefined symbol
>   _socket__Fiii

Look up ``extern "C"'' in the comp.lang.c++ FAQ list
or any good C++ book.

P.S. Your query was not appropriate for comp.std.c++;
followups redirected to comp.lang.c++.

--
Fergus Henderson - fjh@munta.cs.mu.oz.au




Author: bharat@ccvax.ucd.ie
Date: 20 May 94 20:39:34 WET
Raw View
Hi,

I an using GNU C++ version 2.5.8 for building an object
library (on SunOS 4.1.3). When the compiler attempts to
compile one of the .cc files, it gives the following errors:

---------------------------------------------------

188 root@dallas> ./make lib
g++ -I.  -I/usr/local/src/isode/osimis/include -I
-I/usr/local/src/isode/osimis/h -c ipInfo.cc
ipInfo.cc: In function `int initIpInfo()':
ipInfo.cc:134: type `socket' is not yet defined

*** Error code 1
make: Fatal error: Command failed for target `ipInfo.o'
---------------------------------------------------

I add the following line to the ipInfo.cc:

int socket (int, int, int);

Now, the library does build normaly. But I have another program
in which above mentioned library is linked. When I attempt to
compile this program, I get the following error:

------------------------------------------------------------
27 root@dallas> ./make oimsma
g++ Sma.o ../../agent/oim_mib/liboimmib.a
../../agent/oim_mib/liboimsntx.a
../../util/sys_info/libsysInfo.a
../../agent/gms/libgms.a
../../agent/gms/libsmisntx.a
../../msap/libmsap.a
../../kernel/libkernel.a
../../util/util/libutil.a

ld: Undefined symbol
   _socket__Fiii
collect2: ld returned 2 exit status
*** Error code 1
make: Fatal error: Command failed for target `oimsma'
------------------------------------------------------------

Symbol " _socket__Fiii" is in libsysInfo.a, but undefined. I do include
"socket.h" and "types.h" in ipInfo.cc but it doesn't
make any difference. I just wonder why 'ld' doesn't
complain about other undefined symbols in libsysInfo.a.

Does anyone have any clue as to what might be wrong?

Please email your suggestions to me.
Many thanks for your time.

- Bharat,