Has anyone installed and made a hello world program with Qt in Cygwin? I'm getting it to compile but no window is showing up when I run the program.
Could you list the steps that I need to follow (or links if possible) to get this to work?
Here's what I've done:
1. I installed "KDE on Cygwin" by extracting the tar file in the root directory (creating /usr/lib/qt3/*). Maybe I should just try a regular Linux/X11 Qt build?
2. Created a ~/.profile file containing:
QTDIR=/usr/lib/qt3
PATH=$QTDIR/bin:$PATH
MANPATH=$TQDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
3. Created a main.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <qapplication.h>
#include <qpushbutton.h>
usingnamespace std;
int main( int argc, char * args[] )
{
// some extra code left out (making a Mandelbrot fractal)
cout << "Here goes!" << endl;
QApplication app( argc, args );
QPushButton hello( "Hello World!", 0 );
hello.resize( 100, 50 );
app.setMainWidget( &hello );
hello.show();
return app.exec();
}
4. Compiled and ran it, as follows:
> qmake -project
> qmake
> make
g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/usr/lib/qt3/mkspecs/cygwin-g++ -I. -I. -I/usr/include/qt3 -o main.o main.cpp
g++ -Wl,--enable-runtime-pseudo-reloc -o fractal main.o -L/usr/lib/qt3/lib -L/usr/X11R6/lib -lqt -lXext -lX11
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.Info: resolving QString::shared_null by linking to __imp___ZN7QString11shared_nullE (auto-import)
> ./main.exe
Here goes!
>
It works; exactly as described above. I was running the wrong executable. If you notice in the make above, the output file was fractal.exe, not main.exe like it was before I added the Qt part and used qmake.