473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Howto link a lib in my Makefile

Hi all!

I have a problem with my Makefile/library.

My library "libmylib.so" includes the header file <boost/regex.hpp>.

My Makefile uses following variables:

CC = gcc
CXX = g++
LD = g++

CCFLAGS =
CXXFLAGS =
LDFLAGS = -Wl,-soname,libsysinfo.so.1 -shared

CP = cp
LN = ln
MD = mkdir
RM = rm

..PHONY: clean
..PHONY: install
..PHONY: uninstall

[...]

A "make install" works great.

BUT...

when I build a binary which uses libmylib I have to enter:

g++ libmylib-test.cc -lmylib -lboost_regex

How can I avoid "-lboost_regex"? The binary only includes libmylib.

So, how can I link libboost_regex into libmylib to avoid later
linking?

Thanks

Goran

Sep 20 '07 #1
2 2381
On Sep 20, 9:24 am, g.vuko...@gmail.com wrote:
I have a problem with my Makefile/library.
[snip]

That's nice. However, make and similar utilities are off topic here.
Here we only talk about the C++ language. Setting up your keyboard
to write C++ code is off topic also.

You might get better results if you found a group that had something
to do with make, or your operating system, or your compiler. Check
out groups.google.com for a start.
Socks

Sep 20 '07 #2
On Sep 20, 3:24 pm, g.vuko...@gmail.com wrote:
I have a problem with my Makefile/library.
My library "libmylib.so" includes the header file <boost/regex.hpp>.
My Makefile uses following variables:
Note that how to invoke the compiler and the associated tools
(which is really what your question is about) is off topic here,
and you really should ask in a group dedicated to your toolset.
However...

[...
BUT...
when I build a binary which uses libmylib I have to enter:
g++ libmylib-test.cc -lmylib -lboost_regex
How can I avoid "-lboost_regex"? The binary only includes libmylib.
You have to arrange for your library to incorporate the
necessary object files (probably all of them) from the boost
library. How you do this depends very much on your platform;
with the Unix toolset, I think you have to extract the library
into a temporary directory, then add the files from that
directory to your library.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Sep 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
4
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
3
by: Alex Shturm | last post by:
Hi, I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big project (executable size is more than 100Mb, and it gets linked from several dozen of libraries and object...
2
by: Ney André de Mello Zunino | last post by:
Hello. I am having trouble building a simple project that uses one of the Standard C++ Library's IO facilities. The following is a stripped-down version that illustrates the problem: ...
3
by: Lord2702 | last post by:
Sun. Aug. 22, 2004 2:20 PM PT How to create multifile assembly in Managed Visual C++ ? Using VSIDE. Please do not point me to MSDN pages, I already read those pages, and it only says, that you...
4
by: Marco Meoni | last post by:
Hi. I read the Gordon McMillan's "Socket Programming Howto". I tried to use the example in this howto but this doesn't work. The code is class mysocket: '''classe solamente dimostrativa -...
7
by: sanxiyn | last post by:
Skip wrote: For those of us who have never used IronPython or Mono, is there a quick start document laying about somewhere? It wasn't clear to me where to even look. Okay, here we go: 1....
4
by: Jess | last post by:
Hello, I am now trying to use makefile to compile C++ programs. My makefile looks like: f1.o : f1.cpp h1.h h2.h g++ -c f1.cpp f2.o : f2.cpp h2.h h3.h g++ -c f2.cpp
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.