Results 1 to 20 of 20

Thread: Issued in HelloWorld QT programming

  1. #1
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Issued in HelloWorld QT programming

    1. Installed VS2008 completely.

    2. Installed QT 4.5.0.

    3. Tried to setup the following user environment variables,
    PATH => C:\Qt\4.5.0\bin
    QMAKESPEC => win32-msvc2008
    QTDIR => C:\Qt\4.5.0

    4. Tried sample HelloWorld program as shown below,
    a. Created a hello folder

    b. Created hello.cpp and copied the following code into it,
    /************************************************** ****/
    // HelloWorld
    /************************************************** ****/
    #include <QApplication>
    #include <QLabel>

    int main(int arg c, char* argv[])
    {
    QApplication app(argc, arv);
    QLabel *myLabel = new QLabel("Hello World");
    myLabel->show();
    return app.exec();
    }
    /************************************************** ****/
    c. From command prompt, changed the directory to hello, and type qmake -project to create a platform-independent project file (hello.pro). hello.pro file is created successfully.

    d. Ran qmake hello.pro, to create a platform-specific makefile from the project file. But it throws the following error,
    C:\Qt Samples\hello>qmake hello.pro
    Error processing meta file: c:\Qt\4.5.0\lib\qtmain
    Error processing meta file: c:\Qt\4.5.0\lib\qtmaind
    Error processing meta file: c:\Qt\4.5.0\lib\qtmain

    5. Then tried HelloWorld progam from VisualStudio as shown below,
    a. First added QT path in VC++ Directories
    Executables - $(QTDIR)\bin
    Include - $(QTDIR)\include
    Lib - $(QTDIR)\lib
    Source - $(QTDIR)\src

    b. Created a new project (File-> New-> Project-> General-> Makefile Project) named HelloQt.
    Then modified configuration settings as given below,
    Go to Project-> Properties-> Configuration Properties-> Nmake and enter the following in the build command line qmake -project && qmake && nmake release-all. Also enter release\HelloQt.exe in the Output field.

    c. Added HelloQt.cpp and copied the above HelloWorld program.

    d. Tried to build it, but it throws the following error,
    /************************************************** ****************************************/
    // Build Output window
    /************************************************** ****************************************/
    1>------ Build started: Project: HelloQt, Configuration: Release Win32 ------
    1>Performing Makefile project actions
    1>Error processing meta file: c:\Qt\4.5.0\lib\qtmain
    1>Error processing meta file: c:\Qt\4.5.0\lib\qtmaind
    1>Error processing meta file: c:\Qt\4.5.0\lib\qtmain
    1>Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
    1>Copyright (C) Microsoft Corporation. All rights reserved.
    1> "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\nmake.exe" -f Makefile.Release all
    1>Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
    1>Copyright (C) Microsoft Corporation. All rights reserved.
    1> cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -GL -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.5.0\include\QtCore" -I"c:\Qt\4.5.0\include\QtGui" -I"c:\Qt\4.5.0\include" -I"." -I"c:\Qt\4.5.0\include\ActiveQt" -I"release" -I"." -I"c:\Qt\4.5.0\mkspecs\win32-msvc2008" -Forelease\ @C:\DOCUME~1\1494\LOCALS~1\Temp\nm29.tmp
    1>main.cpp
    1>c:\Qt\4.5.0\include\QtCore/qconfig.h(1) : fatal error C1083: Cannot open include file: '../../src/corelib/global/qconfig.h': No such file or directory
    1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0x2'
    1>Stop.
    1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\nmake.exe"' : return code '0x2'
    1>Stop.
    1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
    1>Build log was saved at "file://e:\Sankar\QT\Samples\HelloQt\HelloQt\Release\Build Log.htm"
    1>HelloQt - 4 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    /************************************************** ****************************************/

    Thanks & Regards,
    Sankar.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Issued in HelloWorld QT programming

    Do you have read/write access to those paths and files?

    Edit: there is no need to restart this post the next day.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    Please use [code] tags around your code and code-like output... edit your post and repair it. This is the second time you have been asked.
    Please do not start a new thread on the same topic every time you have another problem.

    When you say:
    2. Installed QT 4.5.0
    How did you install it? Build it from source using your VS 2008 compiler? Why such an old version?

    These are the basic steps:
    • Start a Visual C command prompt from the Windows Start menu OR start a standard command prompt and execute the Visual C setup script: http://msdn.microsoft.com/en-us/libr...=VS.90%29.aspx
    • Execute: SET PATH=C:\Qt\4.5.0\bin;%PATH%
    • Change directory to your project directory
    • Build it: qmake then nmake

    Does this work?

  4. #4
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    tbscope:
    Thanks.
    Yes. I have read/write access to those paths and files.

    Chris:
    Thanks.
    I have been doing the same, what you have asked me to try. But still i am facing the same error.

    Error processing meta file: c:\Qt\4.5.0\lib\qtmain
    Error processing meta file: c:\Qt\4.5.0\lib\qtmaind
    Error processing meta file: c:\Qt\4.5.0\lib\qtmain


    Regards,
    Sankar.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    Can you answer the remainder of my queries?
    How did you install it? Build it from source using your VS 2008 compiler? Why such an old version?

  6. #6
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    First installed VisualStudio2008 full version and then installed Qt 4.5.0 commercial version. I have been instructed to use this version olny.

    Regards,
    Sankar

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    The error is emitted when qmake is trying to process the PRL files in your Qt lib directory. Does c:\Qt\4.5.0\lib\qtmain.prl exist? What does it contain?

    Try running qmake with extra debug output:
    Qt Code:
    1. qmake -d 2> debug.txt
    To copy to clipboard, switch view to plain text mode 
    to see if any useful diagnostic is output.

  8. #8
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Yes, qtmain.prl file exist in the path "C:\Qt\4.5.0\lib\".

    But I couldn't open the file. It says "Access to C:\Qt\4.5.0\lib\qtmain.prl is denied"

    Ran "qmake -d 2> debug.txt" command and it produced debug.txt file which is attached here for your reference.

    Regards,
    Sankar.
    Attached Files Attached Files

  9. #9
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    Quote Originally Posted by sankar View Post
    Yes, qtmain.prl file exist in the path "C:\Qt\4.5.0\lib\".
    Good.
    But I couldn't open the file. It says "Access to C:\Qt\4.5.0\lib\qtmain.prl is denied"
    If you cannot read the file nor can qmake when you run it. Fix your permissions.

  10. #10
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Thanks Chris.

    It worked after fixing my permissions.

    BTW, Could you please explain me the following build commands which will help me to understand it better

    qmake -project => It creates a .pro file. ?

    qmake => ?

    Then how to create an exe from the hello.pro file?

    If you can refer me some tutorial/link for the same will be very useful. Thanks again for sparing your valuable time.

    Regards,
    Sankar.

  11. #11
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    Qt Code:
    1. qmake -project
    To copy to clipboard, switch view to plain text mode 
    Will look at the source files in the directory and build a basic PRO file to make the project. In all but the simplest of program this PRO file will need to be changed, but for a simple "Hello, World!" it should be sufficient. You only need to make a PRO file once, and nothing stops you making one entirely manually.
    Qt Code:
    1. qmake
    To copy to clipboard, switch view to plain text mode 
    Takes the project definition from the PRO file and builds a Makefile (or equivalent) for the environment that qmake finds itself in. Qmake has defaults for compiler, linker, paths etc. that were determined at the time qmake itself was built.
    Qt Code:
    1. make (or equivalent)
    To copy to clipboard, switch view to plain text mode 
    Build the project.

    Open Assistant and read "Using qmake" and "qmake Tutorial" in the "QMake Manual"

  12. #12
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Hi,
    I am using the following command to build PRO & Make files and exe for WINDOWS environment,

    qmake -project
    qmake
    nmake -release

    How do we create the EXE for other platforms (LINUX, SOLARIS,..)

    Thanks &Regards,
    Sankar.

  13. #13
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Could some one help me to fix this

    Thanks &Regards,
    Sankar.

  14. #14
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18
    Thanked 68 Times in 66 Posts

    Default Re: Issued in HelloWorld QT programming

    Quote Originally Posted by sankar View Post
    How do we create the EXE for other platforms (LINUX, SOLARIS,..)
    compile your code on LINUX, and you get a LINUX executable.
    compile your code on SOLARIS, and you get a SOLARIS executable.

    AFAIK there is no way to create an executable for LINUX/... from a WINDOWS environment.

  15. #15
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    It is possible to cross-compile on one platform for another. I suspect this is well beyond the OP's grasp of the situation though.

  16. #16
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Thanks Chris.

    So what do you suggest me to do now?

    Regards,
    Sankar.

  17. #17
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    Follow FelixB's advice, build for each target system on the target system, unless you really want to build a complete cross-compiler suite for each target platform.

  18. #18
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Ok Chris. I agree.

    But, I need to build a complete cross-compiler suite for each platform (Atleast two platforms - Windows & Linux)

    Regards,
    Sankar.

  19. #19
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Issued in HelloWorld QT programming

    No. You already have a native build system on Windows (VS2008 and Qt).

    The easiest way to build your code for a Linux target is to install Linux with GCC and Qt, copy your source code across, and build it on the Linux machine. You don't need another machine... you can use a virtual physical machine (VirtualBox or Vmware).

  20. #20
    Join Date
    Feb 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Issued in HelloWorld QT programming

    Thanks Chris for your detailed information.

    Regards,
    Sankar.

Similar Threads

  1. Replies: 5
    Last Post: 16th December 2010, 11:12
  2. Replies: 3
    Last Post: 20th November 2009, 16:51
  3. Qt 4.4.1 WinCE HelloWorld -> ARMv4i
    By Chris81T in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th September 2008, 11:48
  4. OO programming
    By mickey in forum General Programming
    Replies: 14
    Last Post: 26th August 2008, 20: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.