help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gmake error: No rule to make target lib_file.a


From: D3|\||\|!$
Subject: Re: gmake error: No rule to make target lib_file.a
Date: Wed, 7 May 2008 05:53:45 -0700 (PDT)
User-agent: G2/1.0

On May 6, 9:31 pm, Dave Seaman <dsea...@no.such.host> wrote:
> On Tue, 6 May 2008 06:16:11 -0700 (PDT), D3|\||\|!$ wrote:
> >> These lines are likely bogus:
>
> >> > name_of_project_DEPENDENCIES = ./src/libsrc.a lib_file2.a lib_file3.a
> >> > name_of_project_LDADD = ./src/libsrc.a -llib_file1.a lib_file2.a 
> >> > lib_file3.a
>
> >> They probably should be:
>
> >> name_of_project_DEPENDENCIES = ./src/libsrc.a ./lib_folder/lib_file1.a 
> >> ./lib_folder/lib_file2.a ./lib_folder/lib_file3.a
> >> name_of_project_LDADD =        ./src/libsrc.a ./lib_folder/lib_file1.a 
> >> ./lib_folder/lib_file2.a ./lib_folder/lib_file3.a
> > I tried doing the stuff but then gmake is not able to find the libs
> > during make(though the compilation and linking happens normally...)
> > My problem is "how to pass multiple .a files to a project"?? I have
> > passed the dir_path as a compiler flag as -Ldir_path then I'm trying
> > to pass the lib file names as -llibfile1.a -llibfile2.a...
>
> There's the problem.  To link with the library dir_path/libfile1.a, you
> should use the linker flags
>
>         -Ldir_path -lfile1
>
> This scheme works fine as long is the library is prebuilt, but not if
> it's also a target of the Makefile and has other targets depending on it.
> In that case, you should simply use the filename or pathname, not the
> linker flags, in the dependency rules.  The "-L" and "-l" options are
> understood by ld, but not by make.

> > It is then not able to access then entire string of files. If I remove
> > the prefix -l from the last file, it starts throwing the error "no
> > rule to build target" for the last file.
> > Also, the .a files have a "lib" prefix such as libfilename.a. So I
> > tried passing the name as -lfilename.a but this also worked in the
> > same manner as described above.
>
> The "lib" prefix and the suffix (possibly ".a" or ".so") must be omitted
> when using the "-l" directive.

I supplied the libraryname along with the path as "dir_pathname/
libfilename1.a dir_pathname/libfilename2.a.." in the make options.
Gmake shows success but does not create the corresponding .o and
binary files.

When I hit execute, it throws up a terminal window saying "./
project_dir does not exist".

Another thing: though gmake shows success, it gives the following
message for all the included libraries - "Nothing to do for
libfilename.a"
Also, if I remove all the linker flags and stuff, gmake still shows
the same success message... Is that OK??


reply via email to

[Prev in Thread] Current Thread [Next in Thread]