Stick it to THE MAN
Stick it to THE MAN

Reputation: 5721

Compiling a shared library with Qt on Ubuntu 9.10

I am new to both Qt and Linux C++ development (although I have many years C and C++ development experience on Windows).

I have some legacy C projects (source files and headers - [not using Qt]) that I want to compile into shared libs on Linux.

I am proposing to store my projects under the following structure:

/home/username/Projects/project_name
/home/username/Projects/project_name/src
/home/username/Projects/project_name/build

Can anyone tell me how to do the following (using Qt to simplify the build process)

  1. Create different build configurations (debug, release etc)
  2. Build a configuration to create the appropriate shared library

As an aside, I have only recently installed Ubuntu 9.10 and the only C/C++ development tool I have installed (using SPM) in Qt - so I dont know if I need to install some other GNU C++ tools.

BTW I have already checked and have gcc (v4.4.1) available on my machine. I do not appear to have g++ though - I do not know whether this is significant or not.

Upvotes: 1

Views: 1093

Answers (1)

Chen Levy
Chen Levy

Reputation: 16418

An Ubuntu system doesn't come with build tool chain by default. Instead it has a meta package that you will need to install:

sudo apt-get install build-essential

This will install, among other the g++ compiler, although I am not sure about the Qt headers an such. For them you will need the qt4-dev package (I assume you wish to work with qt4 rather then qt3).

As for the bould structure, you will want to consult the qmake manual, or you might want to consider using CMake (apt-get install cmake) instead. CMake allow for out of build sources, as you require, and personally, I can't recommend it enough.

Upvotes: 2

Related Questions