0

I'm trying to configue QtCreator with no success. I want to open an existing project. When I try to compile and run it, I get only empty black console. It looks like it compiles fine but no output.

I've installed this 32bit version:

Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB) (Info)

enter image description here

When I start a new project, QtCreator wants me to run cmake. When It's done, it works fine. I can also build HelloWorld with "g++ main.cpp"

Can anyone tell me what should I do step by step? I ran out of strength. I don't know why it doesn't work.


I think it is not very important, but I'm using Win7 64bit. First, I tried to install 64bit QtCreator:

Qt 5.2.0 for Windows 64-bit (VS 2012, OpenGL, 589 MB) (Info)

But I had some problems with compilers. It looked like I didn't have them installed. I also tried an online installer and now this 32bit version. Always same result.

EDIT:

I found out something. This works:

ComputerGraphics.pro

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

INCLUDEPATH += C:/Users/user/Desktop/projekty/PocitacovaGrafika2/opencv/include

LIBS += -LC:\\Users\user\\Desktop\\projekty\\PocitacovaGrafika2\\opencv\\bin \
    libopencv_core246d \
    libopencv_highgui246d \
    libopencv_imgproc246d \

SOURCES += main.cpp \

and main.cpp

#include <iostream>

int main(){
    std::cout << "Hello";
    return 0;
}

This even doesn't print Hello (.pro is the same as previously):

#include <iostream>

int main(){
    std::cout << "Hello";
    IplImage* img = cvLoad("Desert.jpg",1);
    cvShowImage("img",img);
    cvWaitKey(0);
    return 0;
}

In debug, it complains:
The gdb process terminated unexpectedly (code 0)
During startup program exited with code 0xc0000135.

Maxim Makhun
  • 2,197
  • 1
  • 22
  • 26
Daniel Katz
  • 2,271
  • 3
  • 25
  • 27
  • The existing application that I want to open should now print "Hello", but when I uncomment the rest, It should be a ray tracer. – Daniel Katz Dec 30 '13 at 19:30
  • Is there any reason you don't use the native compiler for Windows, which is the Microsoft one? Visual Studio Express is free and will probably suit all your needs. And Qt works with MSVS out of the box no problem. – Violet Giraffe Dec 30 '13 at 19:57
  • At the begining the project was a template under Visual Studio. But I had a problem with intellisence, no context help. I could also write C++ code in a notepad. – Daniel Katz Dec 30 '13 at 20:03
  • I changed the template so that I could open it in QtCreator. I was doing it all on 32 bit machine and it worked wonderfully, but now I need at least 2 core CPU, so I'm installing QtCreator on another laptop. – Daniel Katz Dec 30 '13 at 20:09
  • Nevertheless, thank you for your advice. – Daniel Katz Dec 30 '13 at 20:26
  • To clarify, what I meant is use MS compiler in Qt Creator, and use a version of Qt built with MS compiler. Didn't mean use VS (although that's my favourite IDE, but it lacks some features of Creator and Creator is overall very very good). – Violet Giraffe Dec 30 '13 at 20:38
  • Please provide a self-contained main.cpp that reproduces the issue. Refer to sscce.org for details. At the very least, you should tell us how you tried to print the "Hello" world. If it is qDebug(), try fprintf(stderr, "Hello"); for a second. Does that work? – László Papp Dec 31 '13 at 02:36
  • I think, maybe there is something wrong with loading the opencv. – Daniel Katz Dec 31 '13 at 15:40
  • I edited the question. I think it is much more clear now. – Daniel Katz Jan 01 '14 at 23:05

1 Answers1

0

My solution:

1) I've gone through my own tutorial on how to compile opencv for qt-creator with cmake here:

How to link opencv in QtCreator and use Qt library

(but using the latest opencv 2.4.8)

2) I created a folder opencv on desktop. I went into newly created opencv_bin/install and copied a folder include into the opencv on the desktop. I continued into directory: install/x64/mingw and copied both bin and lib into opencv on the desktop.

3) I moved the desktop/opencv directory into a working directory of my project.
i.e cut: desktop/opencv; paste: somepath/myQtProject/

4) My .pro contains a reference like this:

INCLUDEPATH += C:/Users/user/Desktop/projekty/PocitacovaGrafika2/opencv/include

LIBS += -LC:\\Users\\user\\Desktop\\projekty\\PocitacovaGrafika2\\opencv\\bin \
    libopencv_core248d \
    libopencv_highgui248d \
    libopencv_imgproc248d \

And in the main.cpp just #include "opencv2/opencv.hpp"

PS: I hope this will also help somebody else.

Community
  • 1
  • 1
Daniel Katz
  • 2,271
  • 3
  • 25
  • 27