All Questions
13
questions
0
votes
0
answers
256
views
Different ways to generate a shared library
I have a source code which depends on some boost libraries like filesystem, system, datetime. I want to create a shared library(libapi.so). Since this so will be given to clients, I don't want a ...
10
votes
1
answer
581
views
How are external symbols resolved?
I have two files 37064544_p1.cpp & 37064544_p2.cpp with the same content as shown below :
int add(int x,int y)
{
return x+y;
}
I compiled them using
g++ -c 37064544_p2.cpp -o 37064544_p2.o
g++ ...
0
votes
1
answer
185
views
Separately typing each library compiles, but a single static library archive fails
I'm trying to build a single library so that it can be linked easily by a single -l switch. Basically If I compile an executable and type out all the libraries my project needs like so:
g++ ...
1
vote
3
answers
1k
views
Undefined reference to (g++ compilation with static library)
The project files is as this:
source
parser
parser.cpp
parser.hpp
brain
brain.cpp
brain.hpp
I first ran these two commands (pwd source/brain/):
g++ -c brain.cpp -o brain.o
ar ...
1
vote
1
answer
5k
views
linking library for creating static library
I have written some code in Lib_file.h and Lib_file.cpp. I wish to convert this code to a static library. I am able to compile the code (using the command g++ -I <necessary include files> -o ...
1
vote
1
answer
2k
views
g++ creating static library: could not read the symbols archive has no index
I am trying to group a number of SDL utility classes into a static library for C++ using g++. I am using ubuntu linux 11.10 and gcc versión 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3). The version of ar is 2....
1
vote
1
answer
182
views
Issue including library C++
I have a very simple C++ file Multiplier.cpp with the corresponding header file, from which I have created a library using the following commands
$ g++ -o Multiplier.o -c Multiplier.cpp
$ ar cr ...
9
votes
1
answer
2k
views
linking a self-registering, abstract factory
I've been working with and testing a self-registering, abstract factory based upon the one described here:
https://stackoverflow.com/a/582456
In all my test cases, it works like a charm, and ...
0
votes
2
answers
317
views
g++ combining libraries
So, I'm trying to incorporate the libpthread.a library into my own library. But its giving me linker problems when I try and compile the code that uses it. I compile it by doing the following:
g++ ...
0
votes
2
answers
184
views
Include static lib in shared object?
I would like to compile a bunch of static libs into a shared object. So far I have
g++ -Wl -shared -fPIC -o myshared.so objs/*.o
Where the objs/*.o above contains all the object files extracted ...
1
vote
0
answers
305
views
Weird ar linking error
Make the project from scratch (works)
Try to remake without changing any files (doesnt work)
Remove static library
Make again without changing any files (works)
Make again without changing any files (...
0
votes
1
answer
579
views
Trouble compiling a program using an archive (.a)
When I try to compile my file using a library (.a), I get 'fatal error: URLInputStream.h: No such file or directory
compilation terminated.
'. I'm still pretty new to C++, and this seems so simple but ...
0
votes
1
answer
750
views
How do I tell `gar` or `ar` to output `elf32-i386` output?
When I look at the help output from gar -h, it tells me:
[...]
gar: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux [...]
How can I instruct gar to create an elf32-i386 output?