Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Desktop Qt 5.2.0 MinGW 32bit
Qt 6.11 is out! See what's new in the release blog

Desktop Qt 5.2.0 MinGW 32bit

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, i have problem for compilling this code that perfectly worked on Qt4. Error in "main"

    @#include <QtCore/QCoreApplication>

    #include <QColor>

    #include <QDebug>

    #include <QImage>

    #include <QStringList>

    #include <QtCore/qmath.h>

    int main(int argc, char *argv[])

    {

    QCoreApplication app(argc, argv);
    
    
    QString inputFilename;
    
    int inputIndex = app.arguments().indexOf("-i");
    
    if (inputIndex > 0 && inputIndex + 1 < argc )
    
        inputFilename = app.arguments().at( inputIndex + 1 );
    
    
    QString outputFilename("output.png");
    
    int outputIndex = app.arguments().indexOf("-o");
    
    if (outputIndex > 0 && outputIndex + 1 < argc )
    
        outputFilename = app.arguments().at( outputIndex + 1 );
    
    
    bool isPole = app.arguments().contains("-pole");
    
    
    qDebug() << "Syntax: behaimcutter -i INPUTFILE -o OUTPUTFILE [-pole]";
    
    
    if (inputFilename.isEmpty()) {
    
        qDebug() << "No input file provided!";
    
        return 0;
    
    }
    
    
    qDebug() << "Inputfile: " <&lt; inputFilename &lt;&lt; " Outputfile: " << outputFilename;
    
    
    QImage inputImage( inputFilename );
    
    
    if (isPole && inputImage.width()!=inputImage.height()) {
    
        qDebug() << "Input file is not a square!";
    
        return 0;
    
    }
    
    
    QSize outputSize;
    
    
    if (isPole)
    
        outputSize = QSize ( M_PI * inputImage.height(), inputImage.height() / 2 );
    
    else
    
        outputSize = QSize ( inputImage.width(), inputImage.height() );
    
    
    QImage outputImage( outputSize, QImage::Format_ARGB32 );
    
    
    // Go through all the pixels in the output file scanline by scanline.
    
    
    for (int y=0; y < outputImage.height(); ++y) {
    
    
        int start = 0;
    
        int end = 0;
    
    
        if (!isPole)
    
            getLineLimits( inputImage, &start, &end, y );
    
    
        for (int x=0; x < outputImage.width(); ++x) {
    
            QRgb pixelRgb;
    
            if (isPole)
    
                pixelRgb = getPoleInputRgb(inputImage, x, y );
    
            else
    
                pixelRgb = getInputRgb(inputImage, start, end, outputImage, x, y );
    
            outputImage.setPixel(x, y, pixelRgb);
    
        }
    
    }
    
    
    outputImage.save( outputFilename );
    
    
    app.exit();
    

    }@

    The return:
    12:06:23: Starte "C:\Qt\Qt5.2.0\5.2.0\mingw48_32\bin\qmake.exe" C:\behaimcutter\behaimcutter.pro -r -spec win32-g++

    WARNING: TARGET is empty
    WARNING: TARGET is empty
    WARNING: TARGET is empty
    12:06:24: Der Prozess "C:\Qt\Qt5.2.0\5.2.0\mingw48_32\bin\qmake.exe" wurde normal beendet.
    12:06:24: Starte "C:\Qt\Qt5.2.0\Tools\mingw48_32\bin\mingw32-make.exe"
    C:/Qt/Qt5.2.0/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory 'C:/behaimcutter'
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I"." -I"..........\Qt\Qt5.2.0\5.2.0\mingw48_32\include" -I"..........\Qt\Qt5.2.0\5.2.0\mingw48_32\include\QtGui" -I"..........\Qt\Qt5.2.0\5.2.0\mingw48_32\include\QtCore" -I"release" -I"..........\Qt\Qt5.2.0\5.2.0\mingw48_32\mkspecs\win32-g++" -o release\main.o main.cpp
    main.cpp: In function 'int qMain(int, char**)':
    main.cpp:127:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
    g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release.exe release/main.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain -LC:\Qt\Qt5.2.0\5.2.0\mingw48_32\lib -lQt5Gui -lQt5Core
    mingw32-make[1]: Leaving directory 'C:/behaimcutter'
    12:06:25: Der Prozess "C:\Qt\Qt5.2.0\Tools\mingw48_32\bin\mingw32-make.exe" wurde normal beendet

    OS Windows 8 Pro x64.
    Qt build: Qt 5.2.0 MinGW 32bit, [download.qt-project.org]
    Qt build installation settings: default.
    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I don't see any error but only a warning: you don't return anything you are just calling app.exit() and since you don't call exec() you should just have a return 0; there

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        hi,
        i run it with argument -i <input> and -o <output>
        "outputImage.save( outputFilename );" and then exit.

        but it did nothing. That is the problem. WARNING: TARGET is empty
        thanks!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Oups, sorry, I overlooked that one, you didn't give TARGET a value in your pro file. TARGET should contain in this case the name of your application e.g. myApp that will end up being myApp.exe since your on windows

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved