public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* linking problem
@ 2003-12-18  2:01 Barry Cassidy
  0 siblings, 0 replies; 5+ messages in thread
From: Barry Cassidy @ 2003-12-18  2:01 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

Hi,
I am trying to compile and link a set of c files using gcc under cygwin..

I need to link the wsock32 library with my files but it doesn't seem to work
because I keep getting errors related to the wsock32 stuff.

Here are the error messages..

/cygdrive/c/WINNT/TEMP/ccRNnj43.o(.text+0x81):hprof_io.c: undefined
reference to `_ntohl@4'
/cygdrive/c/WINNT/TEMP/ccRNnj43.o(.text+0xab):hprof_io.c: undefined
reference to `_ntohs@4'
/cygdrive/c/WINNT/TEMP/ccRNnj43.o(.text+0x304):hprof_io.c: undefined
reference to `_htonl@4'
/cygdrive/c/WINNT/TEMP/ccRNnj43.o(.text+0x338):hprof_io.c: undefined
reference to `_htons@4'
/cygdrive/c/WINNT/TEMP/ccWLDw2Q.o(.text+0x69):hprof_listener.c: undefined
reference to `_recv@16'
/cygdrive/c/WINNT/TEMP/ccWLDw2Q.o(.text+0x119):hprof_listener.c: undefined
reference to `_ntohs@4'
/cygdrive/c/WINNT/TEMP/ccWLDw2Q.o(.text+0x14e):hprof_listener.c: undefined
reference to `_ntohl@4'
/cygdrive/c/WINNT/TEMP/ccyt4TGz.o(.text+0x1502):hprof_setup.c: undefined
reference to `_socket@12'
/cygdrive/c/WINNT/TEMP/ccyt4TGz.o(.text+0x1516):hprof_setup.c: undefined
reference to `_gethostbyname@4'
/cygdrive/c/WINNT/TEMP/ccyt4TGz.o(.text+0x1589):hprof_setup.c: undefined
reference to `_htons@4'
/cygdrive/c/WINNT/TEMP/ccyt4TGz.o(.text+0x15bc):hprof_setup.c: undefined
reference to `_connect@12'
/cygdrive/c/WINNT/TEMP/cc5OMmd1.o(.text+0x22):hprof_md.c: undefined
reference to `_send@16'
/cygdrive/c/WINNT/TEMP/cc5OMmd1.o(.text+0x53):hprof_md.c: undefined
reference to `_timeGetTime@0'
collect2: ld returned 1 exit status


My command line is as follows..

gcc -mno-cygwin -I$JAVA_HOME/include -I$JAVA_HOME/include/win32 -lwsock32
-Wl,--add-stdcall-alias -shared -o bcprofiler.dll file1.c file2.c

Is there something wrong with the way I am using the -l option to link?

Thanks,
Barry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linking problem
  2012-02-27 23:19 Linking problem rebelstar
@ 2012-02-27 23:43 ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2012-02-27 23:43 UTC (permalink / raw)
  To: rebelstar; +Cc: gcc-help

On 27 February 2012 23:18, rebelstar wrote:
>
> Hi,
>
> I am trying to build a piece of code on 64 bit linux machine gcc ( ++
> compiler ) on eclipse IDE
>
> In the linking stage,it throws an error
>
> Invoking: GCC C++ Linker
> g++ -L/home/a0133140/bcpmodel/bcptest/ -o"test"  ./main.o ./wrapper.o
> -lmylib64
> /usr/bin/ld: cannot find -lmylib64
> collect2: ld returned 1 exit status
>
> I have included the library in the workfolder and tried giving full path
> name,absolute path etc..no success..
> ( The name of the library is mylib64.a)

-lmylib64 makes the linker look for libmylib64.so or libmylib64.a, so
your library has the wrong name.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linking problem
@ 2012-02-27 23:19 rebelstar
  2012-02-27 23:43 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: rebelstar @ 2012-02-27 23:19 UTC (permalink / raw)
  To: gcc-help


Hi,

I am trying to build a piece of code on 64 bit linux machine gcc ( ++
compiler ) on eclipse IDE

In the linking stage,it throws an error

Invoking: GCC C++ Linker
g++ -L/home/a0133140/bcpmodel/bcptest/ -o"test"  ./main.o ./wrapper.o  
-lmylib64
/usr/bin/ld: cannot find -lmylib64
collect2: ld returned 1 exit status

I have included the library in the workfolder and tried giving full path
name,absolute path etc..no success..
( The name of the library is mylib64.a)

Any suggestions?

Thanks.


-- 
View this message in context: http://old.nabble.com/Linking-problem-tp33403514p33403514.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* linking problem
@ 2003-09-03 14:12 m.
  0 siblings, 0 replies; 5+ messages in thread
From: m. @ 2003-09-03 14:12 UTC (permalink / raw)
  To: gcc-help

(Not sure if this is the right group to post to.)

I have trouble linking this simple program using gcc 3.3 on Solaris 9.
It links fine with gcc 3.3 on Linux.  What could be the problem?
Thanks.

#include <string>

int main(void) {
        std::string x="a";
        std::string y="b"+x;              // this does not work
        std::string z=std::string("b)"+x; // this works
        return 0;
}

g++ a.cc

The error is:

Undefined                       first referenced
 symbol                             in file
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const*, char const*)/var/tmp//ccfVrSsO.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linking Problem
@ 2001-04-19  3:05 sanal vk
  0 siblings, 0 replies; 5+ messages in thread
From: sanal vk @ 2001-04-19  3:05 UTC (permalink / raw)
  To: gtk-list, hp, jolyon, help-gcc, agold, glibc-linux, felix

Hi,

I am getting following errors while linking a library, in which I don't have 
any control.

       Undefined reference to _xstat
       Undefined reference to _fxstat

I am using gcc 2.96 on Red Hat Linux release 7.0 (Kernel 2.2.16-22 on an 
i686). I tried installing glibc-2.2.1 and linking vga library but it didn't 
make any difference.

It will be of great help if you can throw some light on this problem.

Ps. Please send a copy of your reply to my personal id(sanalvk@hotmail.com) 
since I am not a member of this group.

Thanks and Regards,
Sanal Kumar V K


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-27 23:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-18  2:01 linking problem Barry Cassidy
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27 23:19 Linking problem rebelstar
2012-02-27 23:43 ` Jonathan Wakely
2003-09-03 14:12 linking problem m.
2001-04-19  3:05 Linking Problem sanal vk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).