Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) Example 18: STL only console application, use of '-spec win32-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 = CppQtCrossCompileToWindowsExample18
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:

 

Failed to start program. Path or permissions wrong?

 

In the project's subfolder 'Debug' there was a file 'CppQtCrossCompileToWindowsExample18.exe' to be found.

 

Starting the executable with Wine:

 

wine CppQtCrossCompileToWindowsExample18.exe

 

Screen output:

 

wine: Bad EXE format for Z:\home\richel\Desktop\CppQtCrossCompileToWindowsExample18.exe

 

This approach is now estimated as a sure fail.

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict