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: Dave Seaman
Subject: Re: gmake error: No rule to make target lib_file.a
Date: Tue, 6 May 2008 16:31:00 +0000 (UTC)
User-agent: slrn/0.9.8.1 (Darwin)

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.


-- 
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>


reply via email to

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