Developer Blog -
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Category: MinGW

g++ template method problem

Quick post about problem which I already solved, but think that could be handy for someone else.

I have following code:

template<class T>
struct Test
	T val;
	template <class T2>
	void DoSomething( T2 &obj )

When compiling under Visual studio, everything is ok. But when try the same code snippet under g++, have following error:

test.cpp: In member function ‘void Test<T>::DoSomething(T2&)’:
test.cpp:48: error: expected primary-expression before ‘int’
test.cpp:48: error: expected ‘;’ before ‘int’

This is because compiler doesn’t known FindByType method, because T2 is templated argument. The solution which I found is in adding keyword template before FindByType method name. So updated source code will look like this:

template<class T>
struct Test
	T val;
	template <class T2>
	void DoSomething( T2 &obj )
		obj.template FindByType<int>();

After this update, code will be compiled correctly under both compilers.

03 Dec 2010

TENG - c++ templating engine

Project site:

External project documentation:

Latest TENG source code: (**Note**: Source code referenced from main site isn't latest! )

How to compile TENG on windows

Compilation under Windows is possible only using MinGW and with few modifications in TENG code (because there is few glitch which didn't meet c++ standards). If you want more information or updated TENG version, please let me know.

15 Nov 2010

Posted by: ludek.vodicka

Programming MinGW Linux #MacOs #Linux #C++ #Windows

How to compile open-source libraries under Windows using MinGW

Lots of open source libraries (like libiconv, libintl, ...) doesn't have MSVC project files or makefiles. Only supported way how to compile given library under Window is using MinGW and MSYS compiler tools.

Here is step-by-step guide how to download, install and compile libraries using MinGW.

Step one download MinGW

From MinGW home web site download "Automated MinGW Installer". Current version could be downloaded here: MinGW Installer

Step two installing

Run downloaded executable. As install directory leave C:\MinGW. It's recommended not to change this path.  On component screen select C compiler, C++compiler, MSYS Basic System and MinGW Developer Toolkit.

After that select next,next,next, finish ;-). After that installer downloads all necessary files. This could take a few minutes.

When installation is done, as next step is necessary to setup PATH variable to c:\MinGW. Installer doesn't modify it automatically. (more info about modifying PATH variable) .

Installing additional gcc compiler and make support

These two packages isn't listed in available components. If you wish to install it, use mingw-get-inst. In c:\MinGW\bin directory run following commands:

mingw-get install gcc g++ mingw32-make msys-base

Step three compiling

Compiling from windows shell

Launch cmd tool, go to directory with source code and use g++.

g++ test.cpp

Compiling from MinGW console

Launching MinGW console

Laung MinGW from startmenu or msys.bat from %INSTALL_PATH%\MinGW\msys\1.0\msys.bat.

How to compile libiconv library

As first, download latest libiconv source files from And extract whole package somewhere on your disk.

Launch MinGW console and go to the extracted directory. When you extracted directory to the path:


Type following command to MinGW console:

cd /p/DependentLibrariesWhole/libiconv-1.13.1

after that, run **configure** with required library params (in our case we want static and dynamic version of library)**:**

configure --enable-static --enable-shared

and than run make


Compiled libraries are located in directory "libiconv-1.13.1\lib\.libs". There is  additional information about building libiconv library on stackoverflow.

Additional How to guides

This list is compilation of answer to questions and informations how to solve some problems which I had during my installations.

How to get list of available parameters for configure script?

Use **"configure --help"** command.

08 Nov 2010

Posted by: ludek.vodicka

Programming MinGW #C++ #MinGW #compile #Windows