Results 1 to 13 of 13

Thread: simple hello world question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Location
    Philadelphia, PA USA
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: simple hello world question

    ok, i think i understand QProcess but what if I want the programs to compile together
    on one makefile?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: simple hello world question

    Quote Originally Posted by chap19150
    ok, i think i understand QProcess but what if I want the programs to compile together
    on one makefile?
    But do you want two separate executables?

    Makefiles for Qt programs are a bit complex, so you use qmake or some other tool to generate them. qmake can't create a single Makefile for two executables, but you can place those programs in separate directories and use a .pro file with TEMPLATE="subdirs" --- this way qmake will generate a Makefile that will run Makefiles from subdirectories (in other words you will have more than one Makefile, but you will be able to compile all programs with a single "make").

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: simple hello world question

    Quote Originally Posted by jacek
    subdirectories (in other words you will have more than one Makefile, but you will be able to compile all programs with a single "make").
    As sample:

    Qt Code:
    1. TEMPLATE = subdirs
    2.  
    3. SUBDIRS = lib_sqlite_qt4 \
    4. date_qdialog \
    5. lib_tidy_src \
    6. lib_wgetqt_src \
    7. src_0
    To copy to clipboard, switch view to plain text mode 
    dir structure .....
    http://ciz.ch/svnciz/_STATIC_LIBS_QT4/

    compile on mac , linux , window .
    1- staticlibs from sqlite3
    2- qdate libs calendar designer plug-in as static libs...
    3- tidy libs to clean html bad & holocaust QTexEdit html
    4- wget libs & network & smtp auth funktion
    5- Final build the programm main.cpp included all libs.... the result one exe win or **.apps mac....
    Last edited by patrik08; 12th June 2006 at 14:45.

  4. #4
    Join Date
    May 2006
    Location
    Philadelphia, PA USA
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question Re: simple hello world question

    Quote Originally Posted by jacek
    But do you want two separate executables?

    Makefiles for Qt programs are a bit complex, so you use qmake or some other tool to generate them. qmake can't create a single Makefile for two executables, but you can place those programs in separate directories and use a .pro file with TEMPLATE="subdirs" --- this way qmake will generate a Makefile that will run Makefiles from subdirectories (in other words you will have more than one Makefile, but you will be able to compile all programs with a single "make").
    ok, I have 2 directories /files/helloworld and /files/qtgui
    I have a makefile for the helloworld program. do I also
    have to put a .pro file in the helloworld directory also, and if
    so what would this contain?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: simple hello world question

    Quote Originally Posted by chap19150
    do I also have to put a .pro file in the helloworld directory also, and if so what would this contain?
    No, you don't have to, but you need a .pro file in /files directory.

    Something like:
    Qt Code:
    1. TEMPLATE = subdirs
    2. SUBDIRS += ./helloworld ./qtgui
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to jacek for this useful post:

    chap19150 (12th June 2006)

  7. #6
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: simple hello world question

    Quote Originally Posted by chap19150
    ok, i think i understand QProcess but what if I want the programs to compile together
    on one makefile?
    If You like external programm must go inside qt.....
    make a static lib from the programm ...
    and on your header .... link the programm original header...
    .... and call the function easy from qt ....

    rewrite cout << to

    sprintf (buffer, "%s%s", one , dwo);
    return buffer;

    Sample static libs programm...
    http://ciz.ch/svnciz/_STATIC_LIBS_QT4/lib_tidy_src/
    have a look on
    http://ciz.ch/svnciz/_STATIC_LIBS_QT...b_tidy_src.pro

    Qmake can compile a lot of programm ... put source on a dir...

    cd dir .... qmake -project && qmake && make
    Grab error and clean the code...
    *** pro file LANGUAGE = C++ or LANGUAGE = C
    if the code is ok ... remove main.cpp and transform to static libs... and call function from qt....

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: simple hello world question

    Quote Originally Posted by patrik08
    rewrite cout << to

    sprintf (buffer, "%s%s", one , dwo);
    return buffer;
    Better use QString and QTextStream instead.

Similar Threads

  1. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  2. Simple Question on getExistingDirectory
    By Naveen in forum Qt Programming
    Replies: 6
    Last Post: 3rd March 2006, 09:44
  3. a simple question: spinbox
    By mickey in forum Newbie
    Replies: 3
    Last Post: 27th February 2006, 15:37
  4. simple question on Class-Members
    By mickey in forum General Programming
    Replies: 7
    Last Post: 4th February 2006, 22:37
  5. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.