Re: KDE2 helloworld.cpp

2002-10-01 Thread John Batistic

On Tue, 2002-10-01 at 14:54, Sean 'Shaleh' Perry wrote:
 On Monday 30 September 2002 18:26, John Batistic wrote:
  
   You do not state so let's start at the beginning.
  
   Do you have the -dev version of the kdelibs as well as qt installed? 
   Rather than depend on environment variables I usually define the path to
   my include files in a makefile.  Also Debian is a little different
   because we actually install qt so that /usr/include/qt exists so you
   should not really need any special variables set.
 
  Yes, I do have kdelibs-dev.
 
  If I fully define the header file path in helloworld.cpp the make fails
  when it reaches other .h calls.
 
  Can you give me an example of how you define the environment variables
  in your makefile to suit the Debian locations?
 
 
 CXXFLAGS=-g -O2 -Wall -W -pedantic
 INCLUDES=-I/home/shaleh/blackbox/current/blackbox-cvs/lib -I/usr/X11R6/include
 LIBS=-L/home/shaleh/blackbox/current/blackbox-cvs/lib -L/usr/X11R6/lib 
 -lblackb\
 ox -lX11
 CXX=g++-3.2
 
 all:
 $(CXX) $(CXXFLAGS) $(INCLUDES) wmtest.cc -o wmtest $(LIBS)
 
 is a makefile I use for a project I am working on currently.  it is not qt 
 based but the ideas are the same.  Also qt requires moc to be run, this may 
 also be part of the problem.
 
Herewith:
[1]my cutdown compile only makefile
[2]my source code
[3]make's output

What am I missing?


[1]
INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
CFLAGS= -pipe -02 -fno-strength-reduce
LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
LIBS= -lqt -lX11 -ltext
CC=g++

helloworld: helloworld.o
$(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)


[2]
/* helloworld.cpp */
#include qapplication.h
#include qlabel.h
#include qstring.h

int main(int argc, char**argv)
{
QApplication app(argc,argv);
QLabel *label = new QLabel (NULL);
QString string (Hello, world);
label - setText(string);
label - setAlignment(Qt::AlignVCenter | Qt::AlignHCentre);
label - setGeometry(0,0,180,75);
label - show();
app.setMainWidget(label);
return(app.exec());
}


[3]
jbat@:~/gcc/kde$ make
g++-c -o helloworld.o helloworld.cpp
helloworld.cpp:2: qapplication.h: No such file or directory
helloworld.cpp:3: qlabel.h: No such file or directory
helloworld.cpp:4: qstring.h: No such file or directory
make: *** [helloworld.o] Error 1

*


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread Colin Watson

On Tue, Oct 01, 2002 at 08:54:34PM +1200, John Batistic wrote:
 INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
 CFLAGS= -pipe -02 -fno-strength-reduce
 LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
 LIBS= -lqt -lX11 -ltext
 CC=g++
 
 helloworld: helloworld.o
   $(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)

You don't actually mention either $(INCLUDES) or $(CFLAGS) in that rule,
so neither will be used.

-- 
Colin Watson  [[EMAIL PROTECTED]]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread John Batistic

On Tue, 2002-10-01 at 21:06, Colin Watson wrote:
 On Tue, Oct 01, 2002 at 08:54:34PM +1200, John Batistic wrote:
  INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
  CFLAGS= -pipe -02 -fno-strength-reduce
  LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
  LIBS= -lqt -lX11 -ltext
  CC=g++
  
  helloworld: helloworld.o
  $(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
 
 You don't actually mention either $(INCLUDES) or $(CFLAGS) in that rule,
 so neither will be used.
 
The reference I am using is the KDE Bible tutorial, which limits my
knowledge to what it says.

Man g++ appears to say that I should add -I$(INCLUDES) to the compiler
command line, but trying that doesn't work.

How should I add INCLUDES to the compiler rule?

John Batistic


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread Colin Watson

On Tue, Oct 01, 2002 at 09:31:10PM +1200, John Batistic wrote:
 On Tue, 2002-10-01 at 21:06, Colin Watson wrote:
  On Tue, Oct 01, 2002 at 08:54:34PM +1200, John Batistic wrote:
   INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
   CFLAGS= -pipe -02 -fno-strength-reduce
   LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
   LIBS= -lqt -lX11 -ltext
   CC=g++
   
   helloworld: helloworld.o
 $(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
  
  You don't actually mention either $(INCLUDES) or $(CFLAGS) in that rule,
  so neither will be used.
 
 The reference I am using is the KDE Bible tutorial, which limits my
 knowledge to what it says.
 
 Man g++ appears to say that I should add -I$(INCLUDES) to the compiler
 command line, but trying that doesn't work.
 
 How should I add INCLUDES to the compiler rule?

Keep it simple and realize that this level of 'make' use is not all that
magic. '-I$(INCLUDES)' doesn't work because it expands to
'-I-I/usr/share/qt/include -I/etc/kde2/include', which is obviously
wrong. Just try this:

  $(CC) $(INCLUDES) $(CFLAGS) $(LFLAGS) -o helloworld helloworld.o $(LIBS)

-- 
Colin Watson  [[EMAIL PROTECTED]]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread John Schmidt

On Tuesday 01 October 2002 02:54 am, John Batistic wrote:
 INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include

Are you absolutely positive that the qt includes are in 
/usr/share/qt/include??

On my system, I have them in /usr/include/qt:

jas@golden:~$ locate qlabel.h
/usr/include/qt/qlabel.h
jas@golden:~$ locate qlabel.h
/usr/include/qt/qlabel.h
jas@golden:~$ locate qstring.h
/usr/include/qt/qstring.h

John


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread John Batistic

On Tue, 2002-10-01 at 21:42, Colin Watson wrote:
 On Tue, Oct 01, 2002 at 09:31:10PM +1200, John Batistic wrote:
  On Tue, 2002-10-01 at 21:06, Colin Watson wrote:
   On Tue, Oct 01, 2002 at 08:54:34PM +1200, John Batistic wrote:
INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
CFLAGS= -pipe -02 -fno-strength-reduce
LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
LIBS= -lqt -lX11 -ltext
CC=g++

helloworld: helloworld.o
$(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
   
   You don't actually mention either $(INCLUDES) or $(CFLAGS) in that rule,
   so neither will be used.
  
  The reference I am using is the KDE Bible tutorial, which limits my
  knowledge to what it says.
  
  Man g++ appears to say that I should add -I$(INCLUDES) to the compiler
  command line, but trying that doesn't work.
  
  How should I add INCLUDES to the compiler rule?
 
 Keep it simple and realize that this level of 'make' use is not all that
 magic. '-I$(INCLUDES)' doesn't work because it expands to
 '-I-I/usr/share/qt/include -I/etc/kde2/include', which is obviously
 wrong. Just try this:
 
   $(CC) $(INCLUDES) $(CFLAGS) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
 
 -- 
Some progress. 
That results in:
makefile:8: *** missing separator.  Stop.
(your suggested line is line 8 and I copy/pasted it)

We're not there yet

John Batistic


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread Colin Watson

On Tue, Oct 01, 2002 at 10:51:12PM +1200, John Batistic wrote:
 On Tue, 2002-10-01 at 21:42, Colin Watson wrote:
  Keep it simple and realize that this level of 'make' use is not all that
  magic. '-I$(INCLUDES)' doesn't work because it expands to
  '-I-I/usr/share/qt/include -I/etc/kde2/include', which is obviously
  wrong. Just try this:
  
$(CC) $(INCLUDES) $(CFLAGS) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
 
 Some progress. 
 That results in:
 makefile:8: *** missing separator.  Stop.
 (your suggested line is line 8 and I copy/pasted it)

Did you break the formatting in your original file? Commands in rules
*must* be prefixed with a tab character.

You might want to read the make documentation - it's very comprehensive.

-- 
Colin Watson  [[EMAIL PROTECTED]]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread Earl F Hampton

LIBS = -lqt -lkdecore

works for me.

On Tuesday 01 October 2002 03:51 am, John Batistic wrote:
 On Tue, 2002-10-01 at 21:42, Colin Watson wrote:
  On Tue, Oct 01, 2002 at 09:31:10PM +1200, John Batistic wrote:
   On Tue, 2002-10-01 at 21:06, Colin Watson wrote:
On Tue, Oct 01, 2002 at 08:54:34PM +1200, John Batistic wrote:
 INCLUDES= -I/usr/share/qt/include -I/etc/kde2/include
 CFLAGS= -pipe -02 -fno-strength-reduce
 LFLAGS= -L/usr/share/qt/lib/ -L/usr/lib/kde2/lib -L/usr/X11R6/lib
 LIBS= -lqt -lX11 -ltext
 CC=g++

 helloworld: helloworld.o
   $(CC) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
   
You don't actually mention either $(INCLUDES) or $(CFLAGS) in that
rule, so neither will be used.
  
   The reference I am using is the KDE Bible tutorial, which limits my
   knowledge to what it says.
  
   Man g++ appears to say that I should add -I$(INCLUDES) to the compiler
   command line, but trying that doesn't work.
  
   How should I add INCLUDES to the compiler rule?
 
  Keep it simple and realize that this level of 'make' use is not all that
  magic. '-I$(INCLUDES)' doesn't work because it expands to
  '-I-I/usr/share/qt/include -I/etc/kde2/include', which is obviously
  wrong. Just try this:
 
$(CC) $(INCLUDES) $(CFLAGS) $(LFLAGS) -o helloworld helloworld.o
  $(LIBS)
 
  --

 Some progress.
 That results in:
 makefile:8: *** missing separator.  Stop.
 (your suggested line is line 8 and I copy/pasted it)

 We're not there yet

 John Batistic

-- 
Earl F Hampton
http://hamiii.sytes.net/index.phtml


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-10-01 Thread John Batistic

On Wed, 2002-10-02 at 12:58, John Batistic wrote:
 On Tue, 2002-10-01 at 22:58, Colin Watson wrote:
  On Tue, Oct 01, 2002 at 10:51:12PM +1200, John Batistic wrote:
   On Tue, 2002-10-01 at 21:42, Colin Watson wrote:
Keep it simple and realize that this level of 'make' use is not all that
magic. '-I$(INCLUDES)' doesn't work because it expands to
'-I-I/usr/share/qt/include -I/etc/kde2/include', which is obviously
wrong. Just try this:

  $(CC) $(INCLUDES) $(CFLAGS) $(LFLAGS) -o helloworld helloworld.o $(LIBS)
   
   Some progress. 
   That results in:
   makefile:8: *** missing separator.  Stop.
   (your suggested line is line 8 and I copy/pasted it)
  
  Did you break the formatting in your original file? Commands in rules
  *must* be prefixed with a tab character.
  
  You might want to read the make documentation - it's very comprehensive.
  
 Colin
 
 You are quite right. I had, in my enthusiam, omitted the leading tab.
 
 I have discovered that if I use the following as a makefile:
 **
 [1]helloworld: helloworld.o
 [3]pwd
 ***
 the result is:
 ***
 jbat@:~/gcc/kde$ make
 [2]g++-c -o helloworld.o helloworld.cpp
 ***
 This replicates the result that I get from using the sample makefile.
 ref[1] produces ref[2] without regard to the ref[3]
 
 Is this:
 an incorrect sample makefile
 or a make default
 or a make bug
 ???
 
My blunder.
I found a typo in the makefile and discovered that the makefile started
processing at the end, not the beginning.

Thanks for all the input.

Humbly
John Batistic


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-09-30 Thread Sean 'Shaleh' Perry

On Monday 30 September 2002 16:55, John Batistic wrote:
 I am unable to compile the KDE2 helloworld.cpp example

 error message from make:

 g++-c -o helloworld.o helloworld.cpp
 helloworld.cpp:2: qapplication.h: No such file or directory
 helloworld.cpp:3: qlabel.h: No such file or directory
 helloworld.cpp:4: qstring.h: No such file or directory
 make: *** [helloworld.o] Error 1

 There appear to be two problems.

 1. $HOME/.profile is not being processed. PATH is not modified to the
 new settings as per the 'installing Qt/X11' reference documentation.

 2. If I force .profile with '. .profile' PATH etc are modified - but
 ignored.

 Any suggestions?

 Thanks

 John Batistic

You do not state so let's start at the beginning.

Do you have the -dev version of the kdelibs as well as qt installed?  Rather 
than depend on environment variables I usually define the path to my include 
files in a makefile.  Also Debian is a little different because we actually 
install qt so that /usr/include/qt exists so you should not really need any 
special variables set.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-09-30 Thread Tom Cook

On  0, John Batistic [EMAIL PROTECTED] wrote:
 I am unable to compile the KDE2 helloworld.cpp example
 
 error message from make:
 
 g++-c -o helloworld.o helloworld.cpp
 helloworld.cpp:2: qapplication.h: No such file or directory
 helloworld.cpp:3: qlabel.h: No such file or directory
 helloworld.cpp:4: qstring.h: No such file or directory
 make: *** [helloworld.o] Error 1
 
 There appear to be two problems.
 
 1. $HOME/.profile is not being processed. PATH is not modified to the
 new settings as per the 'installing Qt/X11' reference documentation.
 
 2. If I force .profile with '. .profile' PATH etc are modified - but
 ignored.

I don't think your path has much to do with it.  If you have:

# apt-get install libqt-dev

and have these #includes in your helloworld.cpp:

#include qt/qapplication.h
#include qt/qlabel.h
#include qt/qstring.h

then you should be able to compile with:

g++ -c -o helloworld.o helloworld.cpp

Note also that the usual (proper?) way of naming C++ source is *.cc or
*.cxx, not *.cpp like M$ do.

Tom
-- 
Tom Cook
Information Technology Services, The University of Adelaide

A child of five could understand this.  Fetch me a child of five.
- Groucho Marx

Get my GPG public key: 
https://pinky.its.adelaide.edu.au/~tkcook/tom.cook-at-adelaide.edu.au



msg04505/pgp0.pgp
Description: PGP signature


Re: KDE2 helloworld.cpp

2002-09-30 Thread Sean 'Shaleh' Perry

On Monday 30 September 2002 19:04, Tom Cook wrote:
 #include qt/qapplication.h
 #include qt/qlabel.h
 #include qt/qstring.h

 then you should be able to compile with:

 g++ -c -o helloworld.o helloworld.cpp

 Note also that the usual (proper?) way of naming C++ source is *.cc or
 *.cxx, not *.cpp like M$ do.

 Tom

actually cpp is a valid and common extension.  In fact both qt and kde use it 
for their own projects.  I happen to use .cc but no use getting into a naming 
scuffle.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-09-30 Thread Tom Cook

On  0, Sean 'Shaleh' Perry [EMAIL PROTECTED] wrote:
 On Monday 30 September 2002 19:04, Tom Cook wrote:
  #include qt/qapplication.h
  #include qt/qlabel.h
  #include qt/qstring.h
 
  then you should be able to compile with:
 
  g++ -c -o helloworld.o helloworld.cpp
 
  Note also that the usual (proper?) way of naming C++ source is *.cc or
  *.cxx, not *.cpp like M$ do.
 
  Tom
 
 actually cpp is a valid and common extension.  In fact both qt and kde use it 
 for their own projects.  I happen to use .cc but no use getting into a naming 
 scuffle.

No, it's not worth it.  I was just looking at the g++ man page that
lists .cc and .cxx but not .cpp.

Regards
Tom
-- 
Tom Cook
Information Technology Services, The University of Adelaide

Never argue with an idiot.  They drag you down to their level, then beat you with 
experience.

Get my GPG public key: 
https://pinky.its.adelaide.edu.au/~tkcook/tom.cook-at-adelaide.edu.au



msg04523/pgp0.pgp
Description: PGP signature


Re: KDE2 helloworld.cpp

2002-09-30 Thread Brian Nelson

Tom Cook [EMAIL PROTECTED] writes:

 On  0, Sean 'Shaleh' Perry [EMAIL PROTECTED] wrote:
 On Monday 30 September 2002 19:04, Tom Cook wrote:
  #include qt/qapplication.h
  #include qt/qlabel.h
  #include qt/qstring.h
 
  then you should be able to compile with:
 
  g++ -c -o helloworld.o helloworld.cpp
 
  Note also that the usual (proper?) way of naming C++ source is *.cc or
  *.cxx, not *.cpp like M$ do.
 
  Tom
 
 actually cpp is a valid and common extension.  In fact both qt and kde use it 
 for their own projects.  I happen to use .cc but no use getting into a naming 
 scuffle.

 No, it's not worth it.  I was just looking at the g++ man page that
 lists .cc and .cxx but not .cpp.

Huh?  I see:

  C++ source files use one of the suffixes `.C', `.cc', `.cxx', `.cpp',
  or `.c++'; preprocessed C++ files use the suffix `.ii'.

-- 
People said I was dumb, but I proved them!


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: KDE2 helloworld.cpp

2002-09-30 Thread Tom Cook

On  0, Brian Nelson [EMAIL PROTECTED] wrote:
 Tom Cook [EMAIL PROTECTED] writes:
 
  On  0, Sean 'Shaleh' Perry [EMAIL PROTECTED] wrote:
  On Monday 30 September 2002 19:04, Tom Cook wrote:
   #include qt/qapplication.h
   #include qt/qlabel.h
   #include qt/qstring.h
  
   then you should be able to compile with:
  
   g++ -c -o helloworld.o helloworld.cpp
  
   Note also that the usual (proper?) way of naming C++ source is *.cc or
   *.cxx, not *.cpp like M$ do.
  
   Tom
  
  actually cpp is a valid and common extension.  In fact both qt and kde use it
  
  for their own projects.  I happen to use .cc but no use getting into a naming
  
  scuffle.
 
  No, it's not worth it.  I was just looking at the g++ man page that
  lists .cc and .cxx but not .cpp.
 
 Huh?  I see:
 
   C++ source files use one of the suffixes `.C', `.cc', `.cxx', `.cpp',
   or `.c++'; preprocessed C++ files use the suffix `.ii'.

Alright, alright, I was wrong, badly wrong.  It says that in my man
page, too.  I was looking at the FILES section, where it lists only
.C, .cc and .cxx.

Tom
-- 
Tom Cook
Information Technology Services, The University of Adelaide

If it weren't for electricity we'd all be watching television by candlelight.
- George Gobol

Get my GPG public key: 
https://pinky.its.adelaide.edu.au/~tkcook/tom.cook-at-adelaide.edu.au



msg04534/pgp0.pgp
Description: PGP signature