Results 1 to 6 of 6

Thread: SIGSEGV Error when debugging with Qt creator.

  1. #1
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default SIGSEGV Error when debugging with Qt creator.

    A related discuss can be found at
    http://www.qtforum.org/article/31937...tml#post119880


    First of all, my environment:
    Ubuntu 12.04
    C++ gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
    Qt Creator 2.4.1 Based on Qt 4.8.0 (32 bit) Built on Mar 21 2012 at 23:05:03
    Eclipse IDE for C/C++ Linux Developers Version: Indigo Service Release 2 Build id: 20120216-1857
    I've got exactly the same problem now. I've got no idea why it is so.
    I tried both Eclipse and QtCreator. Under Eclipse, my application runs fine, but under QtCreator, the application always meeting the SIGSEGV error:

    The inferior stopped because it received a signal from the Operating System.

    Signal name :
    SIGSEGV
    Signal meaning :
    Segmentation fault

    Why the same code passed one IDE, but failed the other????wired...


    Cheers
    Pei
    Welcome to Vision Open
    http://www.visionopen.com

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: SIGSEGV Error when debugging with Qt creator.

    guess I'll put my replies here as well then...

    Quote Originally Posted by amleto
    different compiler?
    Quote Originally Posted by amleto
    either way, it means that there is something wrong with you program - most likely it is something that is 'undefined behaviour', and you are just getting lucky with one compiler/ide
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

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

    Default Re: SIGSEGV Error when debugging with Qt creator.

    You claim both IDEs are using the same compiler so we can eliminate that as a cause. I assume both IDEs are using the same qmake, and therefore generating the same Makefile and linkages, so we can eliminate different compiler flags and libraries as a cause. I also assume that the run time environment is identical so the same libraries are picked up at run time. That leaves the most likely reasons for your program (yes, your code) failing:
    • You are using a an uninitialised, null, or deleted pointer. This might work some of the time but it will crash eventually.
    • You are holding and using a reference to an object that no longer exists: undefined behaviour

    A few minutes running the compiled program in your debugger and inspecting the crash backtrace would have identified the problem far faster than posting the same thing in several forums.

  4. #4
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: SIGSEGV Error when debugging with Qt creator.

    Quote Originally Posted by ChrisW67 View Post
    [LIST][*]You are using a an uninitialised, null, or deleted pointer. This might work some of the time but it will crash eventually.
    [LIST]
    No. I didn't use any pointers. Particularly, for this variable and this piece of code. It's just an object of an OpenCV-defined class, has nothing to do with pointer.

    • You are holding and using a reference to an object that no longer exists: undefined behaviour
    This might be the reason. But this is most probably caused by the difference between Eclipse and QtCreator. So, it seems you are 100% sure that QtCreator itself didn't do anything special here, right?

    A few minutes running the compiled program in your debugger and inspecting the crash backtrace would have identified the problem far faster than posting the same thing in several forums.
    How did you know I hadn't spent several minutes and tried to solve the problem? Clearly, if it's as easy as mentioned by you, I wouldn't have posted the messages on forums. ^_^

    I seriously hope you can tell the difference between Qt Creator and Eclipse next time. Hope you really understand what's the difference between these two IDEs, the inner core, rather than just the superficial things.


    Thanks
    Welcome to Vision Open
    http://www.visionopen.com

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

    Default Re: SIGSEGV Error when debugging with Qt creator.

    Edit: Removed terse response.

    How did you know I hadn't spent several minutes and tried to solve the problem? Clearly, if it's as easy as mentioned by you, I wouldn't have posted the messages on forums.
    How were we supposed to know that? You told us absolutely nothing about what you had done to find the issue in your code before your started blaming everything else.

    I seriously hope you can tell the difference between Qt Creator and Eclipse next time. Hope you really understand what's the difference between these two IDEs, the inner core, rather than just the superficial things.
    I do know the difference between these two dev environments. I also know that an IDE is a glorified text editor and plays no part in generating the actual executable binary: that's done by the compiler and linker in concert using your source. The "inner core" of your IDE, Java, C++, Haskell or pidgin English, has as much to do with code generation as my Aunt Fanny. That's also why I carefully stated my assumptions that you are using the same compiler and the same version of qmake from both IDEs: that eliminates the possibility of different compiler and linker command lines because under these circumstances the Makefile is identical regardless of the IDE.

    I wish you luck finding the problem in your code.
    Last edited by ChrisW67; 22nd July 2012 at 04:42.

  6. #6
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: SIGSEGV Error when debugging with Qt creator.

    Quote Originally Posted by jiapei100
    Quote Originally Posted by Amleto
    either way, it means that there is something wrong with you program - most likely it is something that is 'undefined behaviour', and you are just getting lucky with one compiler/ide
    Hi, Amleto, Thank you very much for your prompt reply ! Thank you !!

    However,
    1) I don't think it has something to do with the compilers.
    I built 11 libraries under Eclipse, and 7 applications under QtCreator, which are based on those 11 libraries. 6 out of these 7 applications work perfect under QtCreator, and there is only 1 doesn't work properly.

    Since 6 are working. Thus, I don't think there is a problem with the compiler. In fact, both Eclipse and QtCreator are using the compiler GCC.

    2) I don't think there are some problems with my code as well.
    Because my code work fine under Codelite (this one supports qmake well) and Visual Studio 2010 (with Qt Integrator).


    Conclusion: It could be a problem about the settings of compiler? I've no idea.


    Anyway, thank you for your reply.


    Best regards
    Pei
    Just because something works sometimes does not mean it is ok code according to the c++ standard. Therefore your supposition, above, is incorrect.

    Compiler settings ... erm, it is still only going to compiler YOUR code. If your program goes wrong it's not the compiler's fault. Unless you are linking incorrect versions of libraries together (e.g. release + debug), 'settings' are not going to be the problem. We are back to YOUR code.

    Can you see a common theme?


    The problem is your code (99% probability).
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. SIGSEGV Error: Very Strange
    By grayfox in forum Qt Programming
    Replies: 18
    Last Post: 16th January 2012, 14:50
  2. Replies: 4
    Last Post: 14th September 2011, 01:18
  3. Qt OpenCV SIGSEGV error help
    By bobo in forum Newbie
    Replies: 3
    Last Post: 13th June 2011, 20:03
  4. Error when debugging with Qt creator
    By NewLegend in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2010, 19:28
  5. debugging in QT Creator
    By talk2amulya in forum Qt Tools
    Replies: 3
    Last Post: 22nd February 2009, 06:50

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.