Problem with library linking / Execution failed [SOLVED]
Hi,
I've just solved the problem listed below again by running a X11 server.
Cordially
-----------------------------------
Hi,
I've just solved the problem listed below in italic by adding the line :
Code:
QT += gui widgets core
to my qmake project file and I was able to compile my source code.
When I try to run it now, I get this error message :
Code:
QXcbConnection: Could not connect to display
Aborted (core dumped)
Can someone help me to solve that ?
-----------------------------------------------------
Hi,
I'm programming with the IDE Cygwin on Windows 10.
I'm trying to compile this source code named "main.cpp" written in c++ which contains :
Code:
#include <QtWidgets/QtWidgets>
int main(int argc, char *argv[])
{
int fontsize = 12;
int fontweight = 50;
bool italic = false;
int windowSizeX = 200;
int windowSizeY = 400;
window.setFixedSize(windowSizeX,windowSizeY);
QFont font
(fontname, fontsize, fontweight, italic
);
bouton.setFont(font);
bouton.setCursor(Qt::PointingHandCursor);
bouton.setToolTip("TestTip");
window.show();
return app.exec();
}
So I used qmake to get the library required with the project file "main.pro" which contains :
Code:
CONFIG += qt
TARGET = test
SOURCES += main.cpp
And it returned me the following compilation line :
Code:
g++ -o test.exe main.o -lpthread -lQt5Gui -lQt5Core -lGL
When I execute it, there are still problems with libraries.
I tried to add -lQt and it solved some dependencies but not all.
I get this error message :
Code:
/cygdrive/d/test/main.cpp:12: référence indéfinie vers « __imp__ZN12QApplicationC1ERiPPci »
/cygdrive/d/test/main.cpp:12:(.text+0x83): relocalisation tronquée pour concorder avec la taille: R_X86_64_PC32 vers le symbole indéfini __imp__ZN12QApplicationC1ERiPPci
/cygdrive/d/test/main.cpp:13: référence indéfinie vers « __imp__ZN7QWidgetC1EPS_6QFlagsIN2Qt10WindowTypeEE »
/cygdrive/d/test/main.cpp:13:(.text+0xb1): relocalisation tronquée pour concorder avec la taille: R_X86_64_PC32 vers le symbole indéfini __imp__ZN7QWidgetC1EPS_6QFlagsIN2Qt10WindowTypeEE
/cygdrive/d/test/main.cpp:16: référence indéfinie vers « __imp__ZN11QPushButtonC1ERK7QStringP7QWidget »
/cygdrive/d/test/main.cpp:16:(.text+0x128): relocalisation tronquée pour concorder avec la taille: R_X86_64_PC32 vers le symbole indéfini __imp__ZN11QPushButtonC1ERK7QStringP7QWidget
/cygdrive/d/test/main.cpp:19: référence indéfinie vers « __imp__ZN7QWidget10setToolTipERK7QString »
/cygdrive/d/test/main.cpp:19:(.text+0x1a8): relocalisation tronquée pour concorder avec la taille: R_X86_64_PC32 vers le symbole indéfini __imp__ZN7QWidget10setToolTipERK7QString
collect2: erreur*: ld a retourné 1 code d'état d'exécution
It's in French but "référence indéfinie vers" stands for "undefined reference to" and the rest is not important.
I guess it's a problem with my qmake project file.
Can someone help me to solve this ?
Cordially
Re: Problem with library linking / Execution failed [SOLVED]
Wow.
Maybe you could put your problem-solving skills to work on finding a way to have world peace...