°C++ Unions & Structures
°C++ STL Map
°C++ String Class
°C++ Coding Style
°C++ XML Beans
°C/C++ Dynamic Memory
°C++ Memory Corruption
°C/C++ Signal Handling
°Jenkins Plugins for C++
°YoLinux Tutorials Index
Free Information Technology Magazines and Document Downloads
Free Information Technology Software and Development Magazine Subscriptions and Document Downloads
|C++ GUI Programming Framework Toolkits:
Cross platform (Linux, MS/Windows, IRIX, Solaris (Gnome will be standard on Solaris 10))
|C++ Graphic Components and Widgets:
- SL.com - Sherrill - Lubinski SL-GMS
Dynamic graphic GUI components and controls for real time interfaces and displays. Common ".m1" file graphic framework for
C++ and Java. Graphic sources include Visio, bitmaps and DXF. Supports pan, zoom, drill-down and hyperlink capability.
Supports input as well as displays.
- Kinesix.com: Sammi - Similar to SL-GMS but not as good.
- Genlogic.com: GLG - Dynamic, data driven visual components.
- ILog.com: Views - Diagramming and data graphing capabilities.
|C++ Web Server CGI Toolkits:
|C/C++ IDE (Integrated Development Environment) for Linux:
The following IDEs will provide an integrated edit, build and debugging environment for C++ on Linux.
(IDEs are cross platform and are available on MS/Windows and other UNIX environments)
Written in Java, this IDE was originally developed for programming JAVA. Since its' inception, it was designed with a plug-in architecture to support other languages and programming needs. For C++ development, one must download the Eclipse CDT version for C++ which is platform dependent and processor word size dependent (32 bit/64 bit) and not the same download as the regular Java Eclipse IDE.
Eclipse Home Page
Download http://eclipse.org/downloads/ - i.e. eclipse-cpp-XXX-linux-gtk-x86_64.tar.gz
Eclipse also requires the Java installation. See YoLinux Java download/installation
Also see: CDT manual
- for all on system:
This installs Eclipse under /opt/eclipse
- mv eclipse-cpp-XXX-linux-gtk-x86_64.tar.gz /opt
- tar xzf eclipse-cpp-XXX-linux-gtk-x86_64.tar.gz
- for yourself only:
This installs Eclipse under /home/your-user-id/eclipse
- Download to your home directory.
- tar xzf eclipse-cpp-XXX-linux-gtk-x86_64.tar.gz
- Run Eclipse:
- Icon for desktop launcher: /opt/eclipse/icon.xpm
- for all on system:
You may also want to include the following Eclipse plug-ins:
If Eclipse is installed in /opt/eclipse/ for system wide use,
you may want to start Eclipse with the following command:
eclipse -data /home/user1/workspace
When downloading Eclipse and Eclipse plug-ins, look at the README files (eclipse/readme/readme_eclipse.html)
to see if you have a matching GTK+ release. If the version of Eclipse
and plug-ins are too new for the version of GTK+ on your system then
Eclipse may not display properly. For older versions of Linux, you may
have to install older versions of Eclipse and older plug-ins. i.e. the
latest version of Eclipse (3.1.1) on the older Red Hat Linux 8.0 will
NOT operate properly. Eclipse 3.1.1 requires GTK 2.2.1 while Red Hat
8.0 uses GTK 2.0.
[Potential Pitfall]: Don't mix 32 bit Java with 64 bit (AMD64/EM64T) Eclipse. Choose all 32 or all 64 bit for Eclipse environment.
Error in ~/workspace/.metadata/.log
Installing the RPM jdk-1_5_0_05-linux-amd64.rpm instead of
the i586 version of Java to run with the x86_64 version of Eclipse
fixes this problem.
- Help/Welcome screen is default upon start-up and gives an
introduction and tutorials on Eclipse . You can later return to this
menu: "Help" + "Welcome".
- I could not find any way to enter gdb debugger
commands. The only input accepted is through the GUI. While it offers
similar capability to MS/VC++, hard core debugging is best left to ddd.
This Sun IDE has refactoring support, profiler integration, fantastic cross referencing and navigation support (not limited to ctags) with code completion. It supports Qt development, Linux GNU, Cygwin and MinGW C/C++ compilers and GDB debuggers.
You can inspect the class inheritance hierarchy, a header's include hierarchy, the type hierarchy, and more.
The only drawback I have experienced is running it remotely over the XMing MS/Windows X-server.
NetBeans is probably the most feature-rich C++ IDE available for Linux.
Netbeans requires Java installations.
See YoLinux Java download/installation
NetBeans for C++
NetBeans C/C++ tutorial
KDevelop has built-in Qt GUI development support (KDesigner), dOxygen auto-documentation support, makefile, ctags based navigation.
Subversion, CVS, Perforce and Clearcase CM client support is built-in.
KDevelop provides cross platform support for MS Windows, Mac OsX, Linux, Solaris and FreeBSD.
It also supports multiple languages such as C/C++, PHP ad Ruby as well as Automake, Make, qMake, CMake and Ant build systems.
This IDE works and is simple to use.
Quick start (using existing C++/Makefile code):
- Start: kdevelop&
or start from Linux menu under "Programming".
- Top tool bar: Project + Import existing project ...
- Directory: select for example ~/projectx/src
- Project name: ProjectX
- Project type: (default) Generic C++ Application (Custom Makefiles)
- Dialog box will ask if you want to populate with files recursively from the project directory: YES
- Select "File Tree" from left side tab to view files.
Use right mouse button to invoke Subversion commands (i.e. update, commit, add, remove, ...)
- Generate CTAGS for file navigation: (navigate to function and variable declarations, etc)
- Select "CTAGS" tab on bottom
- Select "Regenerate" button
- Build (uses your make file):
- Build project (will run makefile)
- Build target:
Debugging: (GUI front-end to GDB)
- Top tool bar: Project + Project options...
- Icon on left: Select "Run Options":
- Directory: "Custom directory"
- Program: ~~~/projectx/bin/Linux/program.exe
Set this to your executable you wish to run.
- Program arguments: --arg1 abc --arg2 xyz
(Select arguments which reflect your development)
- Environment Variables: Add to ~/.bashrc or add them here. See definitions above in this document.
- Bring up program main: ~~/projectx/src/projectXmain.cpp
- Debug > Start
is a solid, simple, intuitive, bug free IDE for
C/C++ development on Linux. Search/Indexing, edit, compile and debug.
Anjuta supports Glade Gtk+ GUI builder, profiling (uses gprof) and memory leak detection (uses valgrind) and has an integrated help.
- YUM: yum install anjuta
- RPMs available from Dag Wieers: Anjuta.
- Ubuntu/Debian: apt-get install anjuta
(requires: anjuta-common, libgtk2.0-dev libgtkmm2.0-dev libgnome2-dev
libgnomemm2.0-dev devhelp-books glade-2 glade-gnome-2
cvs automake autogen indent ctags devhelp gnome-devel libtool)
Code Dragon is an IDE which specifically supports the wxWindows cross platform GUI libraries which mimic Microsoft's GUI look and feel. The IDE itself was developed using wxWindows widget libraries.
Current support and development for this IDE seems to have been dropped although wxWindows development seems to be continuing.
wxWidgets are cross platform and support Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more.
Code Warrior (by Freescale - was Metrowerks) cross platform, also supports allot of embedded platforms, licensed commercial supported product.
The CodeWarrior Development Studio contains all the tools needed to complete a major embedded development project (supports Freescale's IC and microcontroller products).
Other C++ IDEs:
Also see the YoLinux.com list of Linux text editors.
- OpenAmulet - DARPA funded, developed by the School of Computer Science at Carnegie Mellon University 1994-1997. No longer under development but source is still available.
- ICS BX Pro - Motif or Qt GUI builder, C/C++ IDE (commercial product)
- FLTK: Fast Light Toolkit - Cross platform C++ IDE. Supports GUI design and widgets from NEdit and its' own FLUID libraries.
- Source Navigator - Based on Red Hat's original "source navigator" project. [screenshots]
- Slickedit - commercially developed and supported cross platform IDE for C/C++, Perl, Python and PHP. Has various modes including one which allows Slickedit to resemble Microsoft's Visual C++. Supports recordable macros, code navigation, code refactoring, auto-complete, diffs, etc.
- VDKBuilder - IDE specifically designed to support GUI construction using the VDK C++ GTK+ wrapper library. Uses SCONS and not Make for builds.
[Sourceforge project page]
- WideStudio/MWT - Supports C/C++, Ruby, Perl, Python, Java. Cross platform: Win32, Solaris, MacOS, Linux, FreeBSD.
Includes GUI builder/GUI code generator, OpenGL, ODBC, various language encodings.
- Xwpe-Alpha - Text console based IDE to mimic the old Borland MS-DOS C IDE.
- Use a combination of single purpose text console or GUI tools to edit
(vi/vim/gvim, nedit, emacs/xemacs, gedit),
navigate (ctags, cscope)
and debug (GDB, ddd).
|C/C++ Development environment for Linux:
The following tools will provide the infrastructure for a C++ on Linux development environment:
- SCM (Software Configuration Management):
- Bug / issue tracking:
- Build systems:
- GNU gmake/make: GNU make is a build system based on the original UNIX "make" build system but with more features. Install RPM package: make
GNU make manual
- scons: Newer python based, cross platform build system. Great for cross platform development (i.e. MS/Windows and Linux/Unix)
- Automated Nightly/Continuous Build and reporting systems:
- File Compare Tools:
Graphical directory and file diff, merge and edit. KDE3/Qt based.
Supports drag and drop. Comes with S.u.S.E. distro. (Cross platform)
MS/Windows download available.
- Difference: kdiff file1 file2
- Difference: kdiff file1 file2 file3
- Difference of two files: kdiff directory1/file directory2
- Difference: kdiff directory1 directory2
- Merge: kdiff directory1 directory2 -o dest-directory
- Merge: kdiff file1 file2 -m
- Merge: kdiff file1 file2 -o output-file
- Kompare: Ships with KDE SDK. [manual] default for RHEL 5/6
- Meld: Compare, edit and merge.
- tkdiff: [download]
- gvim and gvimdiff
- dirdiff: Directory difference viewer.
- Compiler: Install RPM packages for GNU compiler gcc, gcc-c++, binutils (linker), glibc, glibc-devel, gdb
|Configure a fresh Linux installation for C/C++ development (gcc/g++):
If not pre-configured for software development, the following packages will have to be installed (at a minimum):
- Ubuntu: sudo apt-get install gcc g++ make autoconf automake gawk
- Red Hat: yum install gcc gcc-c++ make autoconf automake gawk binutils
|Coding for cross platform deployment with gcc/g++:
The gcc/g++ compiler is compiled with a number of defined preprocessor variables.
The list of defined variables compiled into gcc/g++ can be viewed by issuing the command: g++ -dumpspecs
The defined preprocessor variables can then be used to handle platform dependencies.
||Platform Variable Name
|GCC: RHEL/Fedora Linux
|Red Hat 8 Linux
|Suse 9.2 Linux
Example C/C++ source code 1:
Example C/C++ source code 2:
#if defined(linux) || defined(sparc)
struct time ts;
#error Unknown OS type
Note use of the "#error" for error processing.
Also see YoLinux GNU Makefile cross platform tips
|Porting C/C++ code from Solaris to Linux
- Use macro for GNU C/C++ specific syntax, include files or macros: #ifdef __GNUC__
- Macros are not always defined in the same header files or perhaps in any at all. Check if defined, if not, include the proper file:
- Include files for an api are sometimes found in different files.
- Linux: #include <unistd.h>
- Solaris: #include <sys/fcntl.h>
- Linux: #include <unistd.h>
- Solaris: #include <sys/types.h>
- Linux: #include <time.h>
- Solaris: #include <sys/types.h>
- Command paths of rm, mv, cp, etc are different for Linux and Solaris:
- Hardware differences will have to be accounted for. SPARC is big endian and Intel x86 is little endian. Binary files and messages will be affected.
See our Big and Little Endian Byte Order conversion tutorial
- Compiler command line options are different between the GNU and Solaris compilers.
- Libraries unique to Solaris can be found in the Open Indiana (was OpenSolaris) GIT repository.
C Library source code:
- lltostr() - convert long long to decimal string
- strlcat() - Appends src to the dstsize buffer at dst
- Lots of Solaris C lib functions are not supported in GNU C library. See function source: [libc list]
- CDE - Common Desktop Environment: CDE Sourceforge page [Download source
- Sun Xview/OpenLook: This was open sourced and can be downloaded and compiled.
Linux Xview/OpenLook resources
- Link error solution:
If you get a similar error ClassName::ClassName[not-in-charge]
The solution is to change the order of the libraries.
i.e. If the following
compile results in an error:
g++ source-file.cpp -lxxx -lyyy -lzzz -L../XXX -L../YYY -L../ZZZ
The solution is to change the order of the libraries:
g++ source-file.cpp -lyyy -lzzz -lxxx -L../XXX -L../YYY -L../ZZZ
The order of the library paths is irrelevant (-L).
- C++ Link error: "undefined reference to `vtable for classname-goes-here`"
My fix was to define a destructor. The virtual base class and destructor required the derived class to define a destructor.
- Architecture independent data types and pointers:
- Avoid 32/64 bit cross platform issues by using pointer type: intptr_t
Use include file stdint.h. MS/Windows uses INT_PTR.
- Avoid integer word size issues by using defined types in stdint.h
- Libraries are typically found in /usr/lib and /lib.
On systems which mix 32 and 64 bit libraries look for /usr/lib64 and /lib64.
- Include file paths:
Use colon separated include paths.
Example: export CPLUS_INCLUDE_PATH=/opt/include:/opt/boost/include
|Name mangling and Mixing C and C++:
Name mangling is the C++ compiler technique used to allow function overloading.
It allows a function of one name to be used with multiple argument signatures.
This is a "behind the scene" compiler operation which does not concern most programmers unless they link with object code generated by other languages including C.
The C++ compiler assumes name mangled function names where the function name includes the argument list data types. For example, the following functions have the following real names in object code symbol table:
To view the function names in the object code, use the tool
|C++ function prototype||Function name in object code (symbol table)|
|void funcA(int, char)||funcA__Fic|
To prevent name mangling of C function calls, encapsulate the function declaration with extern"C".
This is required because most programming languages including "C" do not name mangle function names.
place declarations here
For more details on GNU compiler name mangling see Dan Kegel's Name Mangling notes.
For linking with FORTRAN, see the YoLinux.com tutorial mixing C/C++ and FORTRAN.
- C++ References:
- C++ Library References:
- C++ API's and Toolkits:
- Cross Platorm Support Libraries:
- C++ Links and Info: