Results 1 to 12 of 12

Thread: Problem in running QT Application

  1. #1
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem in running QT Application

    Hello,

    As I mentioned earlier I am using QT Eclipse for my project. I have done some texture mapping in my code.
    After that compilation has gone well but, when I try to run the Application, one Error popup appears and says .exe encountered a problem and needs to be closed.

    When I go for details I can see something like this.

    AppName: Example.exe AppVer: 0.0.0.0 ModName: qtguid4.dll
    ModVer: 4.6.4.0 Offset: 006fb1e6

    I dont understand whether its problem with my code or something else, because when I remove Texture mapping part of the code it works fine. For texture mapping I am just using QT's bindtexture method and standard Opengl commands for drawing.

    I need some help Please...

    Thanks in Advance!

  2. #2
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: Problem in running QT Application

    well, difficult to guess what that could be, but perhaps something related to DEP if you work on windows XP sp2 or newer. I had this problems with OpenGL and solved it by marking my app incompatible with DEP.

  3. #3
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem in running QT Application

    What is this DEP? could you please eloberate? And please let me know how to set that DEP.
    I am using Windows XP with SP3.

    Thanks in Advance!

  4. #4
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: Problem in running QT Application

    http://en.wikipedia.org/wiki/Data_Execution_Prevention

    If you are using visual studio, open project properties, go to linker > advanced, in the field "data execution prevention (DEP)" choose "Image is not compatible with DEP". It was just my guess, it is very likely your problem is something else. Try step-by-step debugging and find the exact line where the app crashes.

  5. #5
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem in running QT Application

    This is because some wrong code in resizeGL() method. Its solved now!

    Other problem is I am not able to load Image from the specified path using QImage.load method.

    Looks like problem lies in Image loading. Code written for Image is not picking the Image from the Path specified.
    imgLoaded = img.load(_sPath); always returns false!
    Path given is : ./PICS/Car_New1.png, Passed as a QString to PICData function.

    Is there a other way to give Path info? I have a project inside Eclipse workspace and inside that i have folder called "PICS", I am just giving that path to it.

    Any Idea?

    Thanks!

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

    Default Re: Problem in running QT Application

    You used a relative path to the image... what is your current directory?

  7. #7
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem in running QT Application

    HI,

    My current directory is Eclipse Workspace.
    the path will besome like this: c:\Eclipse Workspace\project\debug\pics\*.png;

    This is the actual path, Is this is what your question was?

    Thanks!

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

    Default Re: Problem in running QT Application

    When a program fails to open a file that does exist, and you have specified a relative path, the odds are very good that the current working directory is not what you think it is (see QDir::currentPath()).

    You can obtain the location of the program executable using QCoreApplication::applicationDirPath() and build a path to the file that way.
    You can embed images in the executable using the resource system.

    It's also possible the image cannot load because a suitable image format plugin is not available (should not be the case with PNG).

  9. #9
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem in running QT Application

    Now, I have taken the current dir path..still same no results yet. This is what i am doing:

    filename = QDir::currentPath();
    imgLoaded = img.load(filename +"/PICS/Car_New1.PNG" );

    if(true == imgLoaded)
    {
    _sPic.iId = this->bindTexture(img, GL_TEXTURE_2D, GL_RGB);
    _sPic.iHeight = img.height();
    _sPic.iWidth = img.width();
    }

    And, I have added this png in QRC file too its been embeded in Executables also but i dont know how to use this to map to our current context.

    Thanks!

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

    Default Re: Problem in running QT Application

    You seem to have missed the point. What is the value of currentPath()? Is it where you think it is? The current directory can be anywhere on the system and has nothing to do with the location of the program executable.

    The Qt Resource System

  11. #11
    Join Date
    Sep 2011
    Posts
    27
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem in running QT Application

    I have seen some QT open gl Texture examples and I am also doing the same thing almost. But i dont understand why it doesn't work for me - may be I am doing some basic mistake which I am not able to uncover.

    How would I solve it? I dont have any clue about the problem!
    Would it going to help me if I place whole code?

    Thanks!

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

    Default Re: Problem in running QT Application

    I have already told you the most likely thing that is going wrong.

    Qt can only open the file if the file is where you tell Qt it is. If you are using a relative path then the file will be looked for relative to the current working directory of the running process, which can move around as the program runs. This is not generally the same as the directory containing the program executable. Unless you know the actual current working directory then you cannot know whether you are trying to open the file you think you are.

    You can use the Qt resource system to embed the image into your executable (if that meets your needs) so that it can always be found. I have already provided a linking detailing how this is used.

Similar Threads

  1. Replies: 4
    Last Post: 7th September 2011, 23:39
  2. Problem while running my qt application on OMAP3530.
    By vinod sharma in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 13th June 2011, 23:50
  3. problem running application in qvfb
    By maroonmoon in forum Installation and Deployment
    Replies: 0
    Last Post: 25th February 2010, 14:58
  4. getting problem in running qtopia home screen application
    By afgan_rajesh in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 31st January 2008, 08:01
  5. Running application on Mac OS X
    By munna in forum General Discussion
    Replies: 1
    Last Post: 19th April 2006, 21:10

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.