On 2016-11-27 06:03:30 Michele Calgaro wrote:
On 2016/11/27 11:11 AM, Leslie Turriff wrote:
On 2016-11-17 07:17:00 Michele Calgaro wrote:
On 2016/11/17 01:02 PM, Leslie Turriff wrote:
> Hi,
> I'm trying to learn to write a GUI app using the book "C++ GUI
> Programming with Qt 3", which of course is not written with Trinity in
> mind, but hopefully will be enough to get me started. I've already
> figured out that I need to substitute 'tqmake' for 'qmake', but I
can't
> get the
> simple 'helloworld' project to actually compile the c++ code. I've got
> the project generated, and I see the code in its src/ directory, but
> when I try to build it (the book says to use 'make') it says "make:
> Nothing to be done for 'first'."
Take a look at the QT3 tutorial here
https://www.trinitydesktop.org/docs/qt3/tutorial.html
Should be able to get you started with TQt ;-)
Cheers
Michele
Okay, I tried that and got exactly the same results. The tutorial you
cited even has the same mistaken instruction to use qmake instead of
tqmake.
Leslie
I tried tutorial 1: copied the code to a .cpp file, followed the exact
instructions (except replacing qmake with tqmake as you already pointed
out). Works perfectly on my system.
This is a pretty basic tutorial ofcourse, no TDE stuff there, no
tqtinterface. Try to give it a second try :-)
Cheers
Michele
Okay, I removed all files from my Tutorial1 directory, and started
over.
Here's what I get:
@06:19:45,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ echo '/****************************************************************
**
** Qt tutorial 1
**
****************************************************************/
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}' >main.cpp
@06:20:02,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tree -a
.
└── main.cpp
0 directories, 1 file
@06:20:21,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tqmake -project
@06:20:29,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tree -a
.
├── main.cpp
└── Tutorial1.pro
0 directories, 2 files
@06:20:31,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tqmake
@06:20:38,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tree -a
.
├── main.cpp
├── Makefile
└── Tutorial1.pro
0 directories, 3 files
@06:20:40,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ make
g++ -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables -Wall -W -O2 -DQT_NO_DEBUG
-I/usr/share/tqt3/mkspecs/default -I. -I. -I/usr/include -I/usr/include/tqt3 -o
main.o main.cpp
main.cpp:7:26: fatal error: qapplication.h: No
such file or directory
#include <qapplication.h>
^
compilation terminated.
Makefile:67: recipe for target 'main.o' failed
make: *** [main.o] Error 1
@06:20:46,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ tree -a
.
├── main.cpp
├── Makefile
└── Tutorial1.pro
0 directories, 3 files
So, different, but still not working. I searched for qapplication.h and found
it in /usr/include/tqt/QT/, but adding -I/usr/include/tqt/QT/ to the Makefile
INCPATH made no difference.
@06:32:33,leslie@pinto.sixys.site
~/Documents/SourceCode/QT/Tutorial1
$ make
g++ -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables -Wall -W -O2 -DQT_NO_DEBUG
-I/usr/share/tqt3/mkspecs/default -I. -I. -I/usr/include -I/usr/include/tqt3
-I/usr/include/tqt/QT/ -o
main.o main.cpp
main.cpp:7:26: fatal error: qapplication.h: No
such file or directory
#include <qapplication.h>
^
compilation terminated.
Makefile:67: recipe for target 'main.o' failed
make: *** [main.o] Error 1
Leslie
Sorry,
my bad, I never realized the code in the online tutorial and the offline one are different
:-(
I actually went through the same tutorial from the tqt3 local documents, found in
/usr/share/tqt3/doc/html/tutorial1-01.html
This is basically the same page as the online one, but there are small differences in the
include files and Qt objects.
------------------------------
#include <ntqapplication.h>
#include <ntqpushbutton.h>
int main( int argc, char **argv )
{
TQApplication a( argc, argv );
TQPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
-------------------------------
Please try again and let us know.
Cheers
Michele