Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) Example 19: STL only console application, use of '-spec cygwin-g++'

 

Sure fail attempt at solving How to cross-compile a Qt Creator project from Ubuntu to a windows executable?.

 

 

Operating system: Ubuntu 10.04 LTS Lucid Lynx

IDE: Qt Creator 2.0.0

Project type: GUI application

Compiler: G++ 4.4.1

Libraries used:

Project options:

 

 

 

 

Qt project file

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-09-29T10:39:29
#
#-------------------------------------------------
QT       += core
QT       -= gui
TARGET = CppQtCrossCompileToWindowsExample19
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

main.cpp

 

#include <iostream>

int main()
{
  std::cout
    << "I am\n"
    << "* written using Qt Creator under Ubuntu\n"
    << "* tested to compile under Ubuntu\n"
    << "* tested to create a valid Ubuntu binary\n"
    << "* tested to create an invalid Windows executable\n"
    << "  (using -spec win32-g++)\n";
}

 

 

 

 

 

Process

 

In Qt Creator, pressing 'Run' resulted in a working Ubuntu executable.

 

Copying the source to a Cygwin folder, a make was attempted:

 

make

 

Screen output:

 

/usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/cygwin-g++ -unix CONFIG+=debug -o Makefile CppQtCrossCompileToWindowsExample19.pro
/usr/bin/qmake-qt4: /usr/bin/qmake-qt4: cannot execute binary file
make: *** [Makefile] Error 126

 

This approach is estimated to be a sure fail.

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict