Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) BoostLubuntutoWindows 'Hello Boost' using Qt Creator under Lubuntu, crosscompile to Windows

 

Hello Boost is an extension of Hello World. Like Hello World, Hello Boost is a simple console application. Hello Boost, however, also requires the Boost library and to link against the Boost.Regex library.

 

 

Next to the Qt Creator project, there is included:

 

 

 

 

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: CppHelloBoostQtCreatorLubuntuToWindows.pro

 

QT       += core
QT       -= gui
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += ../../Libraries/mxe/usr/i686-pc-mingw32/boost
LIBS += -L../..//Libraries/mxe/usr/i686-pc-mingw32/lib -lboost_regex

 

 

 

 

 

main.cpp

 

#include <iostream>
#include <boost/regex.hpp>


int main()
{
  std::string s = "Hello World";
  s = boost::regex_replace(s,boost::regex("World"),std::string("Boost"));
  std::cout << s << '\n';
}

 

 

 

 

 

CppHelloBoostQtCreatorLubuntuToWindows.sh

 

#!/bin/bash
#From http://richelbilderbeek.nl/CppHelloBoostQtCreatorLubuntuToWindows.htm
echo "Cross compiling to Windows"

myfile="i686-pc-mingw32-qmake"
#myfile="../../Libraries/mxe/usr/bin/i686-pc-mingw32-qmake"
mytarget="CppHelloBoostQtCreatorLubuntuToWindows"
myprofile=$mytarget.pro


if [ -e $myfile ]
then
  echo "MXE crosscompiler '$myfile' found"
else
  echo "MXE crosscompiler '$myfile' not found directly, but perhaps it is in the PATH"
  #exit
fi

if [ -e $myprofile ]
then
  echo "Qt Creator project '$myprofile' found"
else
  echo "Qt Creator project '$myprofile' not found"
  exit
fi

echo "1/2: Creating Windows makefile"
$myfile $myprofile

if [ -e Makefile ]
then
  echo "Makefile created successfully"
else
  echo "FAIL: qmake CppHelloBoostQtCreatorLubuntu.pro"
  exit
fi

echo "2/2: making makefile"

make

if [ -e /release/$target.exe ]
then
  echo "SUCCES"
else
  echo "FAIL"
fi

#Cleaning up
#rm ui_*.*
#rm Makefile
#rm Makefile.*
#rm $target

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml