Results 1 to 2 of 2

Thread: A VERY VERY WEIRD pure c++ problem

  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default A VERY VERY WEIRD pure c++ problem

    Hello All, since this evening I have a very weird problem: I have a problem when executing this code
    Speicherzugriffsfehler (Speicherabzug geschrieben)

    Qt Code:
    1. #include <iostream>
    2.  
    3. int main(int argc, char **argv) {
    4. int* x; *x=2;
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 
    it does compile but says
    Qt Code:
    1. Speicherzugriffsfehler (Speicherabzug geschrieben)
    To copy to clipboard, switch view to plain text mode 
    (Something like segmentation fault in english I think)
    Executing in debug mode will say
    Qt Code:
    1. *** Programm hat Signal SIGSEGV (Segmentation fault) empfangen ***
    To copy to clipboard, switch view to plain text mode 

    I am very confused because I have compiled a lot of other programm so far and I did no change anything to my installation...
    If anyone as an idea....
    I am using ubuntu 12.04

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A VERY VERY WEIRD pure c++ problem

    You have a uninitialized pointer to an int called "x" but there is no object behind it. Dereferencing it tries to overwrite a random address in memory which leads to a segmentation fault.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Weird problem
    By CactusPie in forum Newbie
    Replies: 2
    Last Post: 23rd November 2012, 22:37
  2. QGraphicsItem: pure virtual method call problem
    By phuongot in forum Qt Programming
    Replies: 5
    Last Post: 17th January 2012, 08:35
  3. Weird problem with translate()
    By romariorios in forum Qt Programming
    Replies: 8
    Last Post: 27th July 2011, 21:31
  4. Weird problem with MainWindow
    By giusepped in forum Qt Programming
    Replies: 2
    Last Post: 24th July 2011, 13:17
  5. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 08:51

Tags for this Thread

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.