RSS Feed

My C++ Experience


To learn about programming, C++ is a very popular programming. However, besides the language itself, there are many things need to know.

Compiled language

C++ is a compiled language. Therefore, it is not platform independent like interpreted language such as PHP, Perl, Python and else. Because it is a compiled language, that means the developer should target the platform of the C++ program, Microsoft Windows or other? Because I am using Windows, so I will only focus on Win32.

Why need to target the platform? You might want to develop a cross-platform program, but this is not a good idea to use C++ to develop the program.

If so, why using C++? C++ is quite hard especially dealing with memory, because it doesn’t provide garbage collection (manage the memory automatically). However, using C++ instead of C is because OO (object oriented) is easier for software development.

Then why I choose C++, not VB (Visual Basic)? Though developing C++ program need to target the platform, C++ itself is widely used even in other platform (or OS). Unlike VB, it is used in Microsoft, and BASIC has a lot of dialect, VB is only one of them. But I admit that, VB is faster in developing program.

Compiler, linker and IDE

C++ needs a compiler and linker in order to produce an executable file (.exe file) or binary application file (in the sense of Linux). I myself use Microsoft Visual Studio 6.0, which is an IDE (Integrated Development Environment) during development. IDE is a combination of several development tools: compiler, linker, resource editor, debugger, text editor, and else. So, that is why, using IDE will lack of basic knowledge of compilation.

We can find several free C++ compiler from internet. Compiler generally works together with linker, thus linker is always included with the compiler. Since we need to target the platform of the C++ program, we need to choose a correct compiler. If you are using Microsoft Visual Studio, then no need to think about compiler and linker.

Differences of compilers

A well-known C++ compiler, GCC compiler, is free. However, GCC compiler is for Linux. If you want to use the compiler, there are Cygwin and MinGW which are able to develop Win32 application (Windows 32-bit application). Both compiler is based on GCC compiler. I personally prefer MinGW.

However, different compiler will produce different things even the source code are same. Because of different compiler, the coding might need slightly changed in order to be compiled.


Choosing compiler is quite difficult. Microsoft also provides free C++ compiler, Visual Studio Express. However, it does not provide all header files for developing Windows application. Therefore, it requires “Windows Platform SDK”. Besides that, both Visual Studio Express and Windows Platform SDK are large files, it requires long time to download.

On the other hand, MinGW is very small compare with Visual Studio Express and Windows Platform SDK. But, MinGW is only a compiler. It does not contain IDE which provide GUI for the user like Visual Studio. Therefore, one needs to use an editor like CodeLite or IDE like Dev-C++ to develop. Or you can just use any text editor and compile the coding using commandline. But I personally do not like to use commandline.

Shared library and Object file

Like I said, different compilers produce different things. Using Microsoft compiler, it will produce .lib file for static library and .obj for object file. On the other hand, MinGW which uses GCC compiler, will produce lib*.a for static library and .o for object file because it is based on UNIX,. What does it mean? From what I know, this means that, you cannot use Microsoft linker to link what GCC compiler has compiled, vice-versa. That is why, each compiler has their own header and library for compiling.

Which one is better? I think it is better to know which one you need or which one you prefer.

User Interface


Develop a console program (or commandline) is easiest one. Because it has the lowest dependencies. You can just develop a commandline from a function.

Graphical User Interface (GUI)

Because of the usability, one would like to develop GUI program. I personally prefer to use GUI program.

If you are targeting Microsoft Windows as the platform, the lowest dependencies GUI is using Win32 API. Because Win32 API itself is from Windows OS. That means you do not need other runtime libraries (.dll) except Windows runtime libraries. But, that also means your program can only work in Windows.

Using Win32 API, you can create windows dialog, button, scrollbar, and else. However, it is quite difficult to develop the complex interface using Win32 API.

That is why, Microsoft provide MFC (Microsoft Foundation Class Library) for the user who use Visual Studio. If you are using this, that means your coding will have high dependencies on Visual Studio, because Visual Studio provides MFC library and header files.

Besides MFC, WTL (Windows Template Library) can also be used to develop the GUI for Windows platform. WTL also uses Win32 API and it is free. You can download it from internet.

Besides Win32 API, there are other libraries can be used to build GUI: wxWidgets, Qt, GTK+ and else. All of them are free and cross-platform. That means the coding for the GUI does not only work in Windows like Win32 API. From what I know, wxWidgets is popular for Windows platform, GTK+ is popular in Linux.


For C programming, there is Standard C Library, which provides I/O functions, string functions, math functions, date and time functions, memory functions and else. For C++, there is Standard Template Library (STL), which provides containers such as vector, list, queue, stack, map and else.

However, there is still limitation. That is why there are a lot of libraries written, and we can download from internet. Then, we need to compile the coding so that the compiled libraries are compatible to the compiler we use.

One powerful library that enhance C++ is “Boost”. It provides more powerful functions, containers, and even regular expression for C++. Boost library is accepted to incorporate with next version C++ (which is called C++0x).


C++ often works with C programming, that is why we can found that there exists “C/C++”. C++ can works more than that with the help of libraries.

Interoperability is interoperation between two programming languages. Boost provides “boost.python” which enable C++ to interoperate with Python language. Python language is an interpreted language, and using dynamic data typing, and has many string functions.

Inspired by “boost.python”, Tcl language also provides “C++/Tcl” library for the interoperation between C++ and Tcl.

Besides that, depending on the C++ compiler, the compiler can accept “assembly language” without using library like Boost. However, different compiler parses different assembly language syntax. Microsoft compiler will parse Intel syntax, while GCC compiler will parse AT&T syntax.

Assembly language is a low-level programming language. It is difficult to develop complex program. And the algorithm is harder to read compare with C++ or other high-level programming language. Besides that, using assembly language, we also need to target the platform. Because each computer architecture has its machine language, for example, 32-bit machine is different from 64-bit machine. Even Pocket PC executable file has its own assembly language if you disassemble the file. That is why assembly language is assumed lower portability than other high-level programming language.

Another library

Besides Boost, there is a common library, OpenGL. OpenGL is cross-platform open library. OpenGL libraries are already included in Visual Studio and MinGW. So, for the extension of OpenGL, one might need to use GLUT (OpenGL Utility Toolkit). GLUT can be used to create GUI program based on OpenGL.

Component Object Model (COM)

Since OpenGL is common in 3D development. Microsoft also provide another API for 3D development, that is Direct3D, which is a part of DirectX.

DirectX is a Component Object Model (COM). DirectX includes Direct3D, DirectShow and others. And C++ can be used to implement COM through COM interface. That means, C++ can work with COM.

However, COM is developed by Microsoft. That means, in order to work with COM, Microsoft C++ compiler will be the better choice. This is because, DirectX SDK libraries are compiled with Microsoft C++ compiler. If using GCC compiler, some modifications are needed for the SDK. Therefore, if you want to use DirectShow, your target should be Windows platform.


Most of the software for Windows are proprietary. That means you can earn money. However, if you want to use GCC compiler such as MinGW, then you can download a lot of open source and free to use libraries. However, these libraries have their own license. Therefore, if you want to develop and sell the program, then you need to read the license and agreement carefully before using those open source and free libraries. Or you just stick to Windows and use Visual Studio and DirectX or something else to develop your proprietary software.

Note: These are only my personal experience, do not use this as the general knowledge.


About Allen Choong

A cognitive science student, a programmer, a philosopher, a Catholic.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: