Thread: [Plib-users] linking trouble
Brought to you by:
sjbaker
From: Jos E. <je...@gm...> - 2005-04-27 19:59:45
|
Hi guys, I am trying to experiment with plibnet but can't manage to get it to work. My code (which just binds to a port, nothing else yet) compiles fine, but I can't manage to get it linked. Here's the top part of my output and command: [jos@u15178506 server]$ make g++ -lplibnet -lplibul -o server application.o main.o server.o server.o(.text+0x11): In function `CServer::CServer()': /home/jos/ts/server/server.cpp:7: undefined reference to `netInit()' server.o(.text+0x32):/home/jos/ts/server/server.cpp:9: undefined reference to `netSocket::netSocket()' server.o(.text+0x72):/home/jos/ts/server/server.cpp:11: undefined reference to `netSocket::open(bool)' (etc...) Thus, I already include plibnet and I do have a file called /usr/lib/libplibnet.a, but I nevertheless get undefined references. Any ideas? (My makefile is below) Thanks in advance! Jos EXECUTABLE =3D server CC =3D g++ CFLAGS =3D -Wall -W -pedantic -ggdb LFLAGS =3D -lplibnet -lplibul DFLAGS =3D -A -R -p -u -t -c -Q COMPILE =3D $(CC) $(CFLAGS) -c -g SRCS :=3D $(wildcard *.cpp) OBJS :=3D $(patsubst %.cpp,%.o,$(SRCS)) # Standard target: all: $(EXECUTABLE) # Main target: $(EXECUTABLE): $(OBJS) $(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJS) # All .cpp files have to be compiled to .o files: %.o: %.cpp $(COMPILE) -o $@ $< clean: -rm $(OBJS) $(EXECUTABLE) *~ autodoc.* |
From: Steve B. <sjb...@ai...> - 2005-04-28 03:29:40
|
Jos Elkink wrote: > Hi guys, > > I am trying to experiment with plibnet but can't manage to get it to > work. My code (which just binds to a port, nothing else yet) compiles > fine, but I can't manage to get it linked. I suggest you download the PLIB examples package and check out how the 'net' sample programs are put together. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |
From: Jos E. <je...@gm...> - 2005-04-28 06:45:05
|
> I suggest you download the PLIB examples package and check out how > the 'net' sample programs are put together. I did, actually, but I can't find the difference. Besides, even if I made serious mistakes in the coding, it should still link, shouldn't it? Right now it doesn't recognize the 'netSocket', 'netInit', etc. references, so there is a problem other than coding errors, isn't there? Jos |
From: Steve B. <sjb...@ai...> - 2005-04-28 16:41:40
|
Jos Elkink wrote: >>I suggest you download the PLIB examples package and check out how >>the 'net' sample programs are put together. > > > I did, actually, but I can't find the difference. Besides, even if I > made serious mistakes in the coding, it should still link, shouldn't > it? Right now it doesn't recognize the 'netSocket', 'netInit', etc. > references, so there is a problem other than coding errors, isn't > there? Not necessarily...you might have included some ancient version of the PLIB header files...you might have done something ugly like: // Didn't feel like including the real headers // #include <plib/net.h> extern bool netInit ( float totally_the_wrong_parameter_type ) ; .... int main () { bool x = netInit ( 3.14159 ) ; ... } ...there are all sorts of possibilities for the 'creative' programmer! ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |
From: Frederic B. <fre...@fr...> - 2005-04-28 08:14:00
|
the linker may be sensible to parameter order. Try : g++ application.o main.o server.o -o server -lplibnet -lplibul -Fred Quoting Jos Elkink: > Hi guys, > > I am trying to experiment with plibnet but can't manage to get it to > work. My code (which just binds to a port, nothing else yet) compiles > fine, but I can't manage to get it linked. Here's the top part of my > output and command: > > [jos@u15178506 server]$ make > g++ -lplibnet -lplibul -o server application.o main.o server.o > server.o(.text+0x11): In function `CServer::CServer()': > /home/jos/ts/server/server.cpp:7: undefined reference to `netInit()' > server.o(.text+0x32):/home/jos/ts/server/server.cpp:9: undefined > reference to `netSocket::netSocket()' > server.o(.text+0x72):/home/jos/ts/server/server.cpp:11: undefined > reference to `netSocket::open(bool)' > (etc...) > > Thus, I already include plibnet and I do have a file called > /usr/lib/libplibnet.a, but I nevertheless get undefined references. > Any ideas? (My makefile is below) Thanks in advance! > > Jos > > EXECUTABLE =3D server > > CC =3D g++ > CFLAGS =3D -Wall -W -pedantic -ggdb > LFLAGS =3D -lplibnet -lplibul > DFLAGS =3D -A -R -p -u -t -c -Q > COMPILE =3D $(CC) $(CFLAGS) -c -g > SRCS :=3D $(wildcard *.cpp) > OBJS :=3D $(patsubst %.cpp,%.o,$(SRCS)) > > # Standard target: > > all: $(EXECUTABLE) > > # Main target: > > $(EXECUTABLE): $(OBJS) > $(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJS) > > # All .cpp files have to be compiled to .o files: > > %.o: %.cpp > $(COMPILE) -o $@ $< > > clean: > -rm $(OBJS) $(EXECUTABLE) *~ autodoc.* > > > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Jos E. <je...@gm...> - 2005-04-28 14:28:04
|
Thank you - that solves it! :) I can't say I understand why, but I'm happy enough ... Jos On 4/28/05, Frederic Bouvier <fre...@fr...> wrote: > the linker may be sensible to parameter order. Try : >=20 > g++ application.o main.o server.o -o server -lplibnet -lplibul >=20 > -Fred >=20 > Quoting Jos Elkink: >=20 > > Hi guys, > > > > I am trying to experiment with plibnet but can't manage to get it to > > work. My code (which just binds to a port, nothing else yet) compiles > > fine, but I can't manage to get it linked. Here's the top part of my > > output and command: > > > > [jos@u15178506 server]$ make > > g++ -lplibnet -lplibul -o server application.o main.o server.o > > server.o(.text+0x11): In function `CServer::CServer()': > > /home/jos/ts/server/server.cpp:7: undefined reference to `netInit()' > > server.o(.text+0x32):/home/jos/ts/server/server.cpp:9: undefined > > reference to `netSocket::netSocket()' > > server.o(.text+0x72):/home/jos/ts/server/server.cpp:11: undefined > > reference to `netSocket::open(bool)' > > (etc...) > > > > Thus, I already include plibnet and I do have a file called > > /usr/lib/libplibnet.a, but I nevertheless get undefined references. > > Any ideas? (My makefile is below) Thanks in advance! > > > > Jos > > > > EXECUTABLE =3D server > > > > CC =3D g++ > > CFLAGS =3D -Wall -W -pedantic -ggdb > > LFLAGS =3D -lplibnet -lplibul > > DFLAGS =3D -A -R -p -u -t -c -Q > > COMPILE =3D $(CC) $(CFLAGS) -c -g > > SRCS :=3D $(wildcard *.cpp) > > OBJS :=3D $(patsubst %.cpp,%.o,$(SRCS)) > > > > # Standard target: > > > > all: $(EXECUTABLE) > > > > # Main target: > > > > $(EXECUTABLE): $(OBJS) > > $(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJS) > > > > # All .cpp files have to be compiled to .o files: > > > > %.o: %.cpp > > $(COMPILE) -o $@ $< > > > > clean: > > -rm $(OBJS) $(EXECUTABLE) *~ autodoc.* > > > > > > ------------------------------------------------------- > > SF.Net email is sponsored by: Tell us your software development plans! > > Take this survey and enter to win a one-year sub to SourceForge.net > > Plus IDC's 2005 look-ahead and a copy of this survey > > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > > _______________________________________________ > > plib-users mailing list > > pli...@li... > > https://lists.sourceforge.net/lists/listinfo/plib-users > > >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Frederic B. <fre...@fr...> - 2005-04-28 14:38:53
|
Because it solves unresolved symbols introduced by an argument by looking sequentially in the remainder of the command line, instead of rewinding t= he command line ? -Fred Quoting Jos Elkink: > Thank you - that solves it! :) I can't say I understand why, but I'm > happy enough ... > > Jos > > On 4/28/05, Frederic Bouvier <fre...@fr...> wrote: > > the linker may be sensible to parameter order. Try : > > > > g++ application.o main.o server.o -o server -lplibnet -lplibul > > > > -Fred > > > > Quoting Jos Elkink: > > > > > Hi guys, > > > > > > I am trying to experiment with plibnet but can't manage to get it t= o > > > work. My code (which just binds to a port, nothing else yet) compil= es > > > fine, but I can't manage to get it linked. Here's the top part of m= y > > > output and command: > > > > > > [jos@u15178506 server]$ make > > > g++ -lplibnet -lplibul -o server application.o main.o server.o > > > server.o(.text+0x11): In function `CServer::CServer()': > > > /home/jos/ts/server/server.cpp:7: undefined reference to `netInit()= ' > > > server.o(.text+0x32):/home/jos/ts/server/server.cpp:9: undefined > > > reference to `netSocket::netSocket()' > > > server.o(.text+0x72):/home/jos/ts/server/server.cpp:11: undefined > > > reference to `netSocket::open(bool)' > > > (etc...) > > > > > > Thus, I already include plibnet and I do have a file called > > > /usr/lib/libplibnet.a, but I nevertheless get undefined references. > > > Any ideas? (My makefile is below) Thanks in advance! > > > > > > Jos > > > > > > EXECUTABLE =3D server > > > > > > CC =3D g++ > > > CFLAGS =3D -Wall -W -pedantic -ggdb > > > LFLAGS =3D -lplibnet -lplibul > > > DFLAGS =3D -A -R -p -u -t -c -Q > > > COMPILE =3D $(CC) $(CFLAGS) -c -g > > > SRCS :=3D $(wildcard *.cpp) > > > OBJS :=3D $(patsubst %.cpp,%.o,$(SRCS)) > > > > > > # Standard target: > > > > > > all: $(EXECUTABLE) > > > > > > # Main target: > > > > > > $(EXECUTABLE): $(OBJS) > > > $(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJS) > > > > > > # All .cpp files have to be compiled to .o files: > > > > > > %.o: %.cpp > > > $(COMPILE) -o $@ $< > > > > > > clean: > > > -rm $(OBJS) $(EXECUTABLE) *~ autodoc.* |