News from the Web

Building a typical C/C++ Linux project

Interesting overview of the three main techniques to approach C/C++ portable builds.

Kamel Messaoudi

This tutorial is about building a typical C/C++ Linux project, an application linked against one static library and one shared library, using three different compilation methods: Makefiles, Autotools and CMake. A complete source code is available for download.

This tutorial is meant as a short technical guide for beginners looking for ready-to-use basic samples that they can easily study, understand and extend.

Source code

The typical C/C++ project is composed of an application, a shared library and a static library respectively coded in helloworld, helloshared and hellostatic folders.

The three compilation methods are illustrated as the following figure:

Each folder (the name is self-explanatory) refers to a compilation method and contains two scripts hello_clean_all.sh and hello_build_all.sh that can be called to, respectively, clean and build each project from scratch. The main.cc, helloshared.h, helloshared.cc, hellostatic.h, hellostatic.h source and header files are identical in all folders. Theses projects also…

View original post 543 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s