hi,
I have the following code in my Makefile.am that works fine for simple programs:
so, when I run 'make test', it runs the following command:
however, when I tried to run a program that includes the QuantLib library, I have to give the following command:
so, I modified my Makefile.am to include the following:
but that doesn't work; it gives me the same bunch of errors as it does if I only ran my test program without the -L and -l flags.
-lQuantLib tells the linker to link the file libQuantLib.a, that is a static library, not a dynamic one (shared object) .so, which, being a dynamic
lib, would get loaded at runtime. Just specify the -lQuantLib in the rule:
should do the trick, although /usr/lib should be in the default path to check for libs, and shouldn't need to be explicitly defined.
Obviously, file libQuantLib.a needs to be present in /usr/lib.
hi mirni, thx. for your response.
I edited my Makefile with that code, but it still gives me the undefined reference errors.
Makefile.am
here's a sample of the errors:
when at the $ prompt, I give the following command:
g++ -o test test.cpp -L/usr/lib -lQuantLib
it works perfectly fine??
The plus and equal need to be together, it's one operator, just like in C.
To debug Makefile, you should look at the command that's executed when you run 'make'. The command that's being run is echoed on stdout. Look carefully at that command -- it should be exactly what you want:
Since you are getting the errors, you will see something else:
it'll be missing either the -L/usr/lib or -lQuantLib.
Also, just to be safe, delete the old object file test.o before recompiling.
hi mirni,
thanks for the correction.
I was getting an error message with LD_FLAGS, wherein automake warned me to use AM_LDFLAGS since LD_FLAGS is a user defined variable. then I got warned to use = for AM_LDFLAGS before using +=, so I rewrote Makefile.am as:
and when I run make test,
this is what it shows:
I deleted the old test.o file, and re-ran 'make test'
so, obviously it is not reading the -L or -l flags....any thoughts
why and how I can fix it...
Sorry bacpp, I mistakenly thought you were writing a Makefile and using GNU make. My advice was for that case.
Usage of GNU automake and Makefile.am is different, and I don't have experience with writing Makefile.am myself, but from automake it seems that all you need is:
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
I have 2 libraries in 2 different directories that I build with Makefiles.
library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A?
I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Hi All,
When i am trying to include graphics.h ,dos.h and conio.h, its giving error as follows:
pgm.c:2:17: dos.h: No such file or directory
pgm.c:3:22: graphics.h: No such file or directory
pgm.c:4:19: conio.h: No such file or directory
Whereas stdio.h, stdlib.h and time.h gets... (3 Replies)
Dear All
I am looking for all the system libraries that are accessed by my application Build script i.e. make which in turn will processes makefile.
Is there any specific command from which i can find all the system libraries used by my build script.
Cheers,
Ankur (1 Reply)
Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error:
make: module: command not found
Why is this? Is there any way to run this command in a Makefile?
NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Hi
I am trying to debug a code by including prinf . TO some extended it shows error at one point .
If i include an extra printf it is showing at different point . Can anybody please let em know why it is happening ..
Thaks,
Arun (1 Reply)
Whats the syntax for including a library file in a shell script?
say my shell script name is <abc.sh> and my library file is present in /user/abc/hello/fsfs/fsfsss/library.lib
Please tell how to include this library file in the shell script????? (6 Replies)
I am wondering how I can include external files in a perl script. I'm currently working on a website, and I'd like to put my menu items in a subroutine for example, and put that in another file such as menu.pl. That way, I can call the subroutine from each page (such as news.pl), and if I want to... (2 Replies)
Hi everybody!
I would like to set in the makefile a path that should be the path where the program searches for the libraries loaded at run time.
Is there such a variable to be set in makefile?
Thanks in advance! (1 Reply)