Desktop Qt 5.2.0 MinGW 32bit
-
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: " << inputFilename << " 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 beendetOS Windows 8 Pro x64.
Qt build: Qt 5.2.0 MinGW 32bit, [download.qt-project.org]
Qt build installation settings: default.
Thanks -
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
-
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