[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: #include "foo.moc"
From:       Joerg Anders <j.anders () informatik ! tu-chemnitz ! de>
Date:       2004-03-03 13:32:53
Message-ID: Pine.LNX.4.58.0403031419330.1652 () wicht ! informatik ! tu-chemnitz ! de
[Download RAW message or body]

On Tue, 2 Mar 2004, Joerg Anders wrote:

> On Tue, 2 Mar 2004, Nicolas Goutte wrote:
> 
> > 
> > Are you using:
> > METASOURCES=AUTO
> > in your Makefile.am?
> > 

No, this does not help! Meanwhile I found it has nothing to
do with #include but with special options for some files.

You can download a very simple example from:

http://rnvs.informatik.tu-chemnitz.de/ADMIN_PROB/admin_prob.html

You will see whatever you do: The result is the nonsense command:

/bin/sh ../libtool --silent --mode=compile --tag=CXX g++ .....-fexceptions -c myclassb.moc

Note all works with the 1999ths admin suite. The problem occurs
if you want special compiler options for some files.
For instance in this case:

You have two classes with slots and you want to make small binaries
by avoiding -fexceptions compiler option (reduces 40% binary length):

 class myclassb : public QWidget {     | class myclassb : public QWidget {   
  Q_OBJECT                             |    Q_OBJECT
  public: void print();                |    public: void print();
  private slots:  void slot1();        |    private slots: void slot1();
 };                                    |  };

Because both classes have slots you include at the end of the
appropriate *.cpp files
 #include "myclassa.moc"
and 
 #include "myclassb.moc"

Unfortunately, the file myclassb.cpp uses #include "libclass.h" and
this is defined as:

 class libclass
        public:
           void func1() throws MyError ;
 };

As you can see it uses "throws". Thus, you have to set the compiler
option -fexceptions for *exactly this one file*. Note you cannot
change this because libclass is part of a different library given by
others! So  Makefile.am looks as follows:

 bin_PROGRAMS = myprog
 myprog_SOURCES  = main.cpp myclassa.cpp myclassb.cpp libclass.cpp
 myprog_LDFLAGS = $(KDE_RPATH) $(all_libraries)
 myprog_LDADD  = $(LIB_KFILE) $(LIB_KDEPRINT)
 METASOURCES = AUTO
 # set the include path for X, qt and KDE
 INCLUDES = $(all_includes)

 myclassb.o: myclassb.cpp
        $(LTCXXCOMPILE) $(USE_EXCEPTIONS) -c $<

This leads to the nonsense command:
 |/bin/sh ../libtool --silent --mode=compile --tag=CXX g++ ....-fexceptions -c myclassb.moc


-- 
J.Anders, Chemnitz, GERMANY (ja@informatik.tu-chemnitz.de)
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic