I have tried to find a good guide for how to set Boost up with MinGW, but there seems to be no good one. So I've tried a little on my own. Before I downloaded boost to my computer, my system looked like this:
Windows 7 x86 (32 bit)
The steps I took to set Boost up were the following:
1. Downloading Boost 1.42.0 from sourceforge.net
2. Extracting the archive to C:\Program1\
3. Downloading a prebuilt executable of bjam 3.1.18 and putting it into a folder in my PATH
4. Opening a command prompt window and typing the following:
The last line here I basically just compiled from a number of very different looking (although doing the same thing) command lines I found on the web.
bjam --prefix=C:\Program1\boost_1_42_0 --toolset=gcc link=static install
After that I tried to compile an example program I found at the boost getting started guide, which looked like this:
The Makefile I wrote my self (since they didn't have any guide for how to make it compile with mingw), and it looks like this:
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
in(std::cin), in(), std::cout << (_1 * 3) << " " );
Compiling with "make -k" gave me the following output:
CCFLAGS= -Wall -Wextra -pedantic -g -std=c++98
rm $(OBJ) #Remove .o files
$(CC) $(SRC) $(CCFLAGS) -c #Create .o files
$(OUT) : $(OBJ)
$(CC) $(OBJ) $(CCFLAGS) -o $@ #Link .o files
"error: '::swprintf' has not been declared", why do I get that message? (The only thing I can find about it is that it seems to be a bug in mingw, which have been corrected now - even though it still affects me.) Didn't my boost build properly for mingw; have I maybe used the wrong arguments for bjam, or have I forgot something? I think it's so strange that there is really no good guide for how to build boost for mingw. I mean, mingw's g++ must be one of the most common compilers used when writing c++ applications, at least if you prefer using your own text editor to visual studio.
-*- mode: compilation; default-directory: "d:/Work/Programs/Test_programs/boost_test/" -*-
Compilation started at Wed May 05 23:37:27
g++ main.cpp -Wall -Wextra -pedantic -g -std=c++98 -IC:/Program1/boost_1_42_0 -lmingw32 -c #Create .o files
In file included from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Compilation exited abnormally with code 2 at Wed May 05 23:37:30
I would really appreciate help with this problem so I can get the code to compile. Thank you very much in advance.