Thread: random number gen difficult

  1. #16
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    It would probably make things a lot easier if you compiled with the -g switch. Then when you hit ^C while the program is running you'll have some information about what line you're on, etc. "bt" will give you the backtrace, of what's been called and from where; "next" goes one line at a time (and "list" will tell you where you are in the source code); "print" will print a variable or expression or whatever.

  2. #17
    Registered User
    Join Date
    Apr 2010
    Posts
    79
    taking as result any sy=uggestion

    Code:
    gcc -o -g check -Wall -Wextra gauss2.c GENER01.c check.c -lm
    gauss2.c: In function ‘gauss2’:
    gauss2.c:8: warning: unused variable ‘temp’
    check.c:13: warning: return type defaults to ‘int’
    check.c: In function ‘main’:
    check.c:22: warning: implicit declaration of function ‘settable’
    check.c:30: warning: control reaches end of non-void function
    check: In function `_start':
    (.text+0x0): multiple definition of `_start'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o:(.text+0x0): first defined here
    check: In function `_fini':
    /home/aurel32/debian/co-packages/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:37: multiple definition of `_fini'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o:/home/aurel32/debian/co-packages/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:37: first defined here
    check:(.rodata+0x0): multiple definition of `_IO_stdin_used'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here
    check: In function `__data_start':
    (.data+0x0): multiple definition of `__data_start'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o:(.data+0x0): first defined here
    check: In function `__data_start':
    (.data+0x8): multiple definition of `__dso_handle'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbegin.o:(.data+0x0): first defined here
    check: In function `_init':
    /home/aurel32/debian/co-packages/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:25: multiple definition of `_init'
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o:/home/aurel32/debian/co-packages/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:25: first defined here
    /tmp/ccuZvGKb.o: In function `gauss2':
    gauss2.c:(.text+0x0): multiple definition of `gauss2'
    check:(.text+0xec): first defined here
    /tmp/ccdMv5Rj.o: In function `settable':
    GENER01.c:(.text+0x0): multiple definition of `settable'
    check:(.text+0x240): first defined here
    /tmp/ccdMv5Rj.o: In function `Threepoint':
    GENER01.c:(.text+0x186): multiple definition of `Threepoint'
    check:(.text+0x3c6): first defined here
    /tmp/ccdMv5Rj.o: In function `Eightpoint':
    GENER01.c:(.text+0x2bd): multiple definition of `Eightpoint'
    check:(.text+0x4fd): first defined here
    /tmp/ccdMv5Rj.o: In function `Fourpoint':
    GENER01.c:(.text+0x3c1): multiple definition of `Fourpoint'
    check:(.text+0x601): first defined here
    /tmp/ccdMv5Rj.o: In function `GENER02':
    GENER01.c:(.text+0x4c5): multiple definition of `GENER02'
    check:(.text+0x705): first defined here
    /tmp/ccdMv5Rj.o: In function `Uniform':
    GENER01.c:(.text+0x52e): multiple definition of `Uniform'
    check:(.text+0x76e): first defined here
    /tmp/ccdMv5Rj.o: In function `GENER01':
    GENER01.c:(.text+0x676): multiple definition of `GENER01'
    check:(.text+0x8b6): first defined here
    /tmp/ccdMv5Rj.o: In function `GENER03':
    GENER01.c:(.text+0x7ae): multiple definition of `GENER03'
    check:(.text+0x9ee): first defined here
    /tmp/ccvxl8Rn.o: In function `main':
    check.c:(.text+0x0): multiple definition of `main'
    check:(.text+0xb80): first defined here
    /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
    check:(.dtors+0x8): first defined here
    /usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
    /usr/bin/ld: error in check(.eh_frame); no .eh_frame_hdr table will be created.
    collect2: ld returned 1 exit status

  3. #18
    Registered User
    Join Date
    Apr 2010
    Posts
    79
    which gcc edition are you using

  4. #19
    Registered User
    Join Date
    Apr 2010
    Posts
    79

    random number gen difficult

    Any idea left.?
    @tabstop Which edition of gcc compiler you have used?

  5. #20
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I was using 4.4.something. You definitely shouldn't be getting multiple definition errors, unless you managed to copy a file into itself.

  6. #21
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > gcc -o -g check -Wall -Wextra gauss2.c GENER01.c check.c -lm
    -o expects an argument.
    Perhaps
    -g -o check ....
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #22
    Registered User
    Join Date
    Apr 2010
    Posts
    79

    Almost drive me crazy

    As you can see the code above run at the case of tabstop but not in mine although I am doing exactly the same. Moreover, when tabstop uses the -Wall to take the warnings he has warnings for the GENERO1.c which is not happening in my case... Could you please also see if you get results and someone tell what i can do.


    PLEASE

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. random number generator help
    By mayoussa89 in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2010, 07:26 AM
  2. couple questions for very small random number program
    By nick753 in forum C++ Programming
    Replies: 7
    Last Post: 01-17-2010, 09:35 PM
  3. Random number in range generation.
    By hebali in forum C Programming
    Replies: 19
    Last Post: 03-04-2008, 10:46 AM
  4. adding a number to a number
    By bigmac(rexdale) in forum C Programming
    Replies: 11
    Last Post: 10-24-2007, 12:56 PM
  5. random number tutorial
    By 7stud in forum C++ Programming
    Replies: 3
    Last Post: 07-26-2005, 02:41 PM