C++ compilation - crash - gdb debugging - pvm

As you have noticed in class, a computer is not perfect and not smart enough to understand all your needs...
That's why we constructed this page!
This page will be updated regularly, if you still have problems, contact me, so we can add it to this page!!

  • Try to report the problem (what is the problem, error messages, ...) as exact as possible
  • C++ compilation & linking

    Problem Possible solutions
    warning: clock skew detected... this is no real problem, don't worry
    warning: implicit declaration of function xxx (compilation) the header file where this function is declared, is not included
    or you mistyped the functions name
    cannot find function at link time be sure the file in the header and c-file or exactly the same
    "multiple definitions of ..." compiler or linker found 2 times the same function:
     - or you reimplemented an existing function
     - or you linked the same object file multiple times
    linking of libraries when a library is using another, the link order is important!! If lib2 is using lib1, you should link in this order: -llib2 -llib1
    program crashes for big problem sizes
    the sizes of static arrays (eg: int arr[10000]) are limited! Use dynamic arrays (arr = new int[10000])
    link error "undefined reference to vtable for class x"
    your class is not complete (not all methods are implemented...)
    put each qt QObject class (widgets etc) in a separate file!
    with qt signals & slots, you sometimes need to compile it a second time (so that the moc file is generated)
    problems with templates read this important comment
    crash with a glibc error
    while using PAPI or our PAPIprofiler
    Don't put your code in a directory with a name containing spaces


    Problem Possible solutions
    while debugging, gdb stops regularly
    Program received signal SIG32, Real-time event 32
    execute handle SIG32 pass noprint nostop to ignore these stops

    Crash errors

    Most common reasons for a C++ program to crash (segmentation fault):
    1. be carefull with pointers and memory allocation!!
    2. index goes out of array range : this is not checked by C++ (unlike Modula-2)
    Run your program with the debugger and inspect the call stack after the crash with 'up'.

    gdb debugging

    Problem Possible solutions
    can't find file (when trying to put a breakpoint) the -g compile flag must be set (makefile) or debug for the tmake CONFIG
    Warning: source file is more recent than executable it means that you should recompile the executable!


    Problem Possible solutions

    failed to add machine to pvm the computer you are working on should be added to .rhosts file
    problems adding machines on infopc4 the pvm of infopc4 got a lot of errors...
    run your program on a different computer, eg infopc23 with rsh infopc23 (do this for the 3 consoles)

    Problem Possible solutions