Archive
C++0x Support Chart, and a Revision to Nomenclature
Thought you might like to ssee C++0x support for various compilers. Here is a list for GCC, or you can check out this comparison, which features many of the major compilers: Digital Mars’, Intel’s, Microsoft’s, IBM’s and, of course, GCC.
You’ll see that GCC has better support than many, which is in fact why I’ve recently switched from Microsoft Visual Studio to Code::Blocks and/or Qt Creator. I might post a little more about my experiences thereof at a later date. In particular, notice that both MSVC and GCC support long long and nullptr (about which I posted late yesterday). Indeed, long long has unanimous support across all the compilers mentioned in the chart.
And what about the last part of the title? Well I’ve been continuing to say C++0x (and probably will still do so), but as we can expect it’s release sometime this year, I guess I should start saying C++11. Ah well, I probably won’t. That is all.
Related articles
- C++0x Suffix Return Types (sfmlcoder.wordpress.com)
- C++0x Is Official: Unanimously (cplusplus-soup.com)
- Introduction to C++0x (sfmlcoder.wordpress.com)
- C++ 11 Approved (herbsutter.com)
A Choice of Compilers
As C++ programmers, the one of our most important tools is the compiler. So which compiler should you use. Well there are several good choices, which I shall list here.
- Microsoft Visual C++: This is a great compiler from Microsoft – which comes with Visual Studio and Visual C++ Express. While Visual Studio is rather expensive, you can get Visual C++ Express absolutely free.
- g++: This is the C++ compiler that comes with GCC (the GNU Compiler collection)
- Intel Composer: I mentioned this one in yesterday’s tip of the day. It’s not cheap, but it does have good optimisation features.
Now, there are others, so feel free to comment with your suggestions and opinions. You can also visit my programming software polls page, where you can vote on your favourite IDE and compiler.
Building SFML 2.0 with NMake (for Visual Studio)
In this tutorial I’m going to show you how to build the SFML 2.0 binaries from the source using NMake, that is the Visual Studio make utility. Here is a Windows batch file which should build SFML for you. Of course, it’s best to read the tutorial anyway as it will introduce you to CMake and NMake – two very useful development tools.
The Video
Read on for the textual tutorial. Even if you watch the video, it’s worth a look as we will be using console commands.
Video Modes and Windowing
Hello, and welcome. Today we’re going to discuss windowing and video modes in more detail. That is, we shall see how we can manipulate windows, and control their attributes. Also, of course, we discuss video modes, and how we can best use them.
The Video
Linker Problems and Rebuilding
Sometimes you might get a linker error caused by something like the omission of a preprocessor macro (e.g. SFML_STATIC for SFML static linkage).
After you go back and change this, and click build again, your IDE might just link again – the compilation passed without errors so it doesn’t realise the problem is there. However, preprocessor directives are of course treated before compilation so to ensure the preprocessor macro is added, you must recompile.
To force the IDE to compile as well as link, even though it judged the compilation to be successful, you must select Rebuild rather than just Build.
C++0x!
If you haven’t yet looked into C++0x, then you really should. While many of the features aren’t of course yet provided by compilers, various vendors seem to have started adding some – I know for a fact that Visual Studio has a fair few. If you want to read about the new standard, Bjarne Stroustrup’s FAQ isn’t a bad starting point.
http://www2.research.att.com/~bs/C++0xFAQ.html
Related articles
- The C++0x auto keyword (sfmlcoder.wordpress.com)
- ISO C++ Committee Approves C++0x Final Draft (developers.slashdot.org)
The C++0x auto keyword
You know the C++ auto keyword? The somewhat pointless one which is the default storage specifier anyway? Well in C++0x, the keyword has been re-purposed and now serves a more useful role!
(Remember, this is a feature of the upcoming standard, so it won’t necessary be widely supported yet. However, I have successfully compiled all the code below – apart from bits specifically designed to create errors – in both MSVC and MinGW.)
Consider the following code. Read more…
Creating a first SFML Project
In my last post, I provided videos to show you how to build SFML 2.0 from the source in Visual Studio or Code::Blocks. I also provided some general textual instructions for the same purpose.
Well today I present to you two more videos: this time on how to make a first project using SFML 2.0 in Visual Studio or Code::Blocks. This will include configuring search directories and adding libraries to the linker list, as well as compiling some sample code.
Following are some basic textual instruction on this process. It is split into three sections:
- Visual Studio/Visual C++
- Code::Blocks
- General (this applies to both, and hopefully other IDEs too) Read more…
Building SFML 2.0
| Note: this tutorial is deprecated. Please take a look at one of my new ones, either for Visual C++/NMake (Windows), MinGW (Windows) or GCC/Make (Ubuntu/other Unix). |
To set up SFML 2.0, there are a number of steps. If you want, you can watch SFML 2.0 build video for Code::Blocks, or for Visual Studio.
Otherwise, I shall outline the necessary steps here, before providing a few more details where necessary.
- Download CMake from the website, or go straight to the download page.
- Download the SFML 2.0 source, unzip the file, move it to an accessible location and rename the folder.
- Create a solution file for your IDE using CMake, setting BUILD_SHARED_LIBS to TRUE.
- Take note of the value of STATIC_STD_LIBS, as you must link the C runtime to your project in the same manner as it is linked to the SFML binaries
- Open the solution file in your IDE and build SFML 2.0 in Debug and Release configuration (if your IDE supports multiple configurations).
- Repeat steps 3 & 4, with BUILD_SHARED_LIBS set to false.
- If your IDE does not support multiple configurations, repeat steps 3 – 5, setting.
- Copy and paste the resulting libraries to a better location: put them all in a lib subdirectory of your main SFML 2 directory: c:/sfml/sfml2.
Read more…

