static-libraries

What is the difference between .LIB and .OBJ files? (Visual Studio C++)

I know .OBJ is the result of compiling a unit of compilation and .LIB is a static library that can be created from several .OBJ, but this difference seems to be only in the number of units of compilation. Is there any other difference? Is it the same or different file format? I have come to this question when wondering if the same stati...

Using a static library in QT Creator...

Greetings, I'm having a hell of a time finding documentation which clearly explains how to use a static library in QT Creator. I've created and compiled my static library using QT Creator (New=>Projects\C++ Library=>Set type to "Statically Linked Library"). It compiles and spits out a ".a file". The problem I encounter is when I try t...

Does OS matter when compiling for iPhone?

Hi, I fairly new on iPhone development and I'm currently trying to add some static libraries to my project but I get the "Symbol(s) not found" error. I've googled the issue and tried different solutions without any luck. The libraries are compiled on a PC and not on a Mac so my questions are: Do I need to compile the code on a Mac? W...

Initializing qt resources embedded in static library

Hi folks, I have next situation: I need to create widget in standalone static library, which then will be linked with final application (visual c++ 9.0, qt 4.5). This static widget library contains some resources (icons), and consist of a several .cpp files (each contains standalone widget). As far as I know, i must initialize qt resour...

How to load an image stored in a static library

in my iphone app, I am linking with a static library containing objective c files and images. Is it possible to load an image from a static library? I have tried [UIImage imageNamed:[[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"png"]]; but obviously the image is not in the main bundle, it's in the static library and th...

Is there a way to determine which version of Visual Studio was used to compile a static library?

I have a collection of static libraries (.lib) files one of which may have been built with a different version of Visual Studio. This is causing the code generation of a project that links against all of them to fail. Is there any way to determine which version of Visual Studio was used to compile a static library? ...

Troubles at Including (Linking) a static library inside another one.

Hi, I'll try to explain shortly what I want to do: A project using a static library which have another one as depandency. It produce a project called MyProject linking on MyLib1 linking on MyLib2. Here is the compile order: MyLib2 MyLib1 (linking to MyLib2) MyProject (linking to MyLib1) I'm using Visual Studio 2008 and I have some ...

Static libraries in version-cross-compiled program

I have a unix command line app (with big nasty makefile) that I'm trying to run on a mac. I am compiling it on a 10.6 system, with all of the appropriate libraries of course. The deployment environment is a 10.5 system, with no extra libraries. I compiled without -dynamic, and it appears to have static libraries, correctly. When I run i...

Forcing inclusion of static library object files that don't export any symbols (GCC/iPhone)

Hi, I'm creating a static library for use in iPhone applications. It contains a number of source files which export no symbols, all they do is instantiate a static instance of a class which then runs some code in its constructor that registers various things with a central manager class elsewhere. This all works fine when the code is bu...

Static lib that links another static lib and qmake? Odd linking error

I have two qt .pro files, both using the lib TEMPLATE and staticlib CONFIG. The first library (lets call it 'core') is a dependency for the second lib (I'll call it 'foo'). In fact, there's a class in foo that extends a class in core, I will call this class Bar. When I instantiate the class (which is defined and implemented in foo, but ...

Libraries "rt" and "dl" in Cygwin

Perhaps this is stupid but I'm unable to find out which package I have to install in Cygwin to fix the following missing libraries: config.status: creating unix.buildinfo config.status: creating include/HsUnixConfig.h cabal.exe: Missing dependencies on foreign libraries: * Missing header file: HsUnix.h * Missing C libraries: rt, dl A...

How to move non static variables from interface to implementation in objectiveC?

Hey, I am trying to write a cocoa touch static library. To keep it simple I would prefer not to use private variables within my interface file. The code right now looks like this: interface file (myView.h): @interface myView: UIView { NSTimer * myTimer; } @end implementation file (myView.h) @implementation myView @end This NS...

newbie C runtime library questions in Visual Studio 2008

I've just gotten an application to compile and run by telling my VS 2008 project to ignore libc.lib in the linker->input section off the project properties menu. Before I did this VS gave me the old "fatal error LNK1104: cannot open file 'LIBC.lib'" message. I'm not sure how this app compiles if I'm ignoring the crt, but that's obvious...

Force relink when building in QT Creator

Greetings, I have a subdirs project which wraps a couple libraries and a main application. When I change something in one of the libraries the main application does not relink with them.. does anyone have a trick for getting an application to relink with its statically linked libs automatically when using QT Creator? -Dan O ...

The .NET equivalent of static libraries?

I'm building a tool in managed code (mostly C++/CLI) in two versions, a 'normal user' version and a 'pro' version. The fact that the core code is identical between the two versions has caused me a little trouble as I want to package the resulting tool as a single assembly (DLL) and I don't want to have to include the .cpp files for the...

Trying to include a library, but keep getting 'undefined reference to' messages

I am attempting to use the libtommath library. I'm using the NetBeans IDE for my project on Ubuntu linux. I have downloaded and built the library, I have done a 'make install' to put the resulting .a file into /usr/lib/ and the .h files into /usr/include It appears to be finding the files appropriately (since I no longer get those err...

How to know when to use the .a or .so when linking to Boost?

I wanted to try out the Boost::Serialization library for a project I'm working on. I'm also trying to get used to programming in Linux as well. I set up boost in its default locations. I tried compiling the test file they provide here with the command line arguments they provide and it worked fine. In this example they use the .a file. ...

CMake Visual Studio linking executable with static library

I have a very simple (currently just a main.cpp) CMake C++ project that I'm trying to build on both Mac OS X and Windows. It depends on libgsasl, which I have compiled as a static library on both platforms. Mac OS X has no problems building, and Windows doesn't complain during the build either and produces an EXE. When I try to run the ...

Linking a shared library against a static library: must the static library be compiled differently than if an application were linking it?

At least on Linux and Solaris, static libraries are really just a bunch of compiled .o's tossed into one big compressed file. When compiling a static library, usually the -fpic flag is ommited, so the generated code is position dependent. Now say my static library is B. I've built it and have the resulting .a file which is really just ...

Resources in a static lib file - MFC

MFC is failing to launch my dialog boxes, it seems, because it can't find the resource identifiers. The dialog boxes are in a separate .lib file (so it has a separate .rc file, which, I'm assuming, somehow conflicts with the one in my .exe file). How should I be handling this situation? ...