digitalmars.D.learn - help with library build
- sclytrack pi.be Jun 16 2006
- Sclytrack pi.be Jun 16 2006
I'm having some trouble with the library. Everything in one directory.
dxl.d in the library.
dxl.d (library)
-----
#module dxl;
#int teller(int x)
#{
# return x+1;
#}
main.d (application)
------
#module main;
#import std.stdio;
#import dxl;
#int main()
#{
# int boe=teller(2);
# writefln("Testing Libraries");
# return 0;
#}
makefile
--------
all: libdxl.so main.o
cc -o main.exe main.o -lphobos -lpthread -lm -ldxl
main.o: main.d
dmd -c main.d
libdxl.so: dxl.d
dmd -c -fPIC dxl.d
cc -shared -o libdxl.so dxl.o
clean:
-rm *.o
-rm *.so
-rm *~
-rm main.exe
run:
/main.exe
Execution of make
-----------------
dmd -c -fPIC dxl.d
cc -shared -o libdxl.so dxl.o
dmd -c main.d
cc -o main.exe main.o -lphobos -lpthread -lm -ldxl
/usr/bin/ld: cannot find -ldxl
collect2: ld returned 1 exit status
make: *** [all] Error 1
directory listing
-----------------
dxl.d dxl.o libdxl.so main.d main.o makefile
More Info
---------
I've a library and I've changed some things to it. And it won't build anymore,
but the previous revision still runs fine. However I wanted to discover the
problem so I tried it again in small scale. I'm having a memory blackout or
something, because I can't even get the test version to operate.
Thanks.
Jun 16 2006
I've been trying to solve this problem for hours. cc -o main.exe main.o -lphobos -lpthread -lm -L. -ldxl I've been reading the book again after the post. I forget the -L. so forget it. This is the second time I posted to soon. Sorry. In article <e6uabg$2594$1 digitaldaemon.com>, sclytrack pi.be says...I'm having some trouble with the library. Everything in one directory. dxl.d in the library. dxl.d (library) ----- #module dxl; #int teller(int x) #{ # return x+1; #} main.d (application) ------ #module main; #import std.stdio; #import dxl; #int main() #{ # int boe=teller(2); # writefln("Testing Libraries"); # return 0; #} makefile -------- all: libdxl.so main.o cc -o main.exe main.o -lphobos -lpthread -lm -ldxl main.o: main.d dmd -c main.d libdxl.so: dxl.d dmd -c -fPIC dxl.d cc -shared -o libdxl.so dxl.o clean: -rm *.o -rm *.so -rm *~ -rm main.exe run: /main.exe Execution of make ----------------- dmd -c -fPIC dxl.d cc -shared -o libdxl.so dxl.o dmd -c main.d cc -o main.exe main.o -lphobos -lpthread -lm -ldxl /usr/bin/ld: cannot find -ldxl collect2: ld returned 1 exit status make: *** [all] Error 1 directory listing ----------------- dxl.d dxl.o libdxl.so main.d main.o makefile More Info --------- I've a library and I've changed some things to it. And it won't build anymore, but the previous revision still runs fine. However I wanted to discover the problem so I tried it again in small scale. I'm having a memory blackout or something, because I can't even get the test version to operate. Thanks.
Jun 16 2006








Sclytrack pi.be