Results 1 to 6 of 6

Thread: Compiling simple C code

  1. #1
    Senior Member registered user
    Join Date
    Apr 2005
    Location
    italy
    Posts
    245

    Compiling simple C code

    I'm tryng some C exercises in my 3.8.2 knpx, and the follow is an example:
    /* Program to calculate the product of two numbers. */
    #include <stdio.h>

    int a,b,c;

    int product(int x, int y);

    main()
    {
    /* Input the first number */
    printf("Enter a number betwen 1 and 100: ");
    scanf("%d", &a);

    /* Input the second number */
    printf("Enter another number betwen 1 and 100: ");
    scanf("%d", &b);

    /* Calculate and display the product */
    c = product(a, b);
    printf ("%d times %d = %d\n", a, b, c);

    return 0;
    }

    /* Function returns the product of its two arguments */
    int product(int x, int y)
    {
    return (x * y);
    }
    When I try to compile it with "gcc namefile.c" I have the follow error message:
    /tmp/cc0KOUWj.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status
    Any suggest? Thanks!

  2. #2
    Junior Member
    Join Date
    Dec 2005
    Posts
    2

    gcc trouble

    Hi!
    I was wondering if you ever did resolve this problem because I'm getting the same error message : (

    Thanx!

  3. #3
    Senior Member registered user
    Join Date
    Apr 2005
    Location
    italy
    Posts
    245
    I can't figure out what appened at the time of this post. I've just tried it right now and it works!!!
    I've reinstalled knoppix since that time and maybe there was some strange/wrong settings...

  4. #4
    Junior Member
    Join Date
    Dec 2005
    Posts
    2
    Hi!
    I used the command g++ instead of gcc and everything worked! I'm very new to Linux so I'm just trying things out, seeing what happens basically. Thank you for your help

  5. #5
    Administrator Site Admin-
    Join Date
    Apr 2003
    Location
    USA
    Posts
    5,441
    Quote Originally Posted by maxIT
    I can't figure out what appened at the time of this post. I've just tried it right now and it works!!!
    I've reinstalled knoppix since that time and maybe there was some strange/wrong settings...
    You know, you never mentioned in your first post that you had "installed" Knoppix. Yes, this is the hddinstall forum, but it serves a few others uses too and people here are not always the greatest about using the best forum. You might have received better response if 1) you had spelled out that this was a hard disk "install" and 2) you had also tested the same thing booting from a CD or DVD and told us the result that way too.

  6. #6
    Senior Member registered user
    Join Date
    Apr 2005
    Location
    italy
    Posts
    245
    Sorry HK about that.
    I was thinking that posting something in the "Hdd Install...." forum implied by itself that I was talking about an HDinstallation

Similar Threads

  1. Problem with compiling source code
    By Redbeard in forum Hdd Install / Debian / Apt
    Replies: 1
    Last Post: 12-01-2007, 05:35 PM
  2. compiling source code
    By crazy_monkey108 in forum General Support
    Replies: 14
    Last Post: 07-04-2006, 07:52 AM
  3. Three simple questions!
    By nick47 in forum General Support
    Replies: 5
    Last Post: 09-26-2005, 02:28 AM
  4. Simple DNS question...
    By RandomGoon in forum Networking
    Replies: 2
    Last Post: 12-18-2004, 05:59 AM
  5. Problem with compiling a c++ code
    By estranged in forum General Support
    Replies: 3
    Last Post: 08-21-2003, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot picture

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot

$285.90



Microsoft Office 2021 Pro Plus USB for 1PC Windows 10 & 11 picture

Microsoft Office 2021 Pro Plus USB for 1PC Windows 10 & 11

$62.50



TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot picture

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot

$573.98



lOT OF 4 SKhynix 8GB (4 x 8GB =32GB) HMA41GR7MFR8N-TF 2R8 PC4-2133P DDR4 MEMORY picture

lOT OF 4 SKhynix 8GB (4 x 8GB =32GB) HMA41GR7MFR8N-TF 2R8 PC4-2133P DDR4 MEMORY

$89.00



128GB (4x32GB) SK hynix DDR4 PC4-2666V RDIMM ECC Server Ram HMA84GR7CJR4N-VK picture

128GB (4x32GB) SK hynix DDR4 PC4-2666V RDIMM ECC Server Ram HMA84GR7CJR4N-VK

$799.00



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$826.09



USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot picture

USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot

$3.75



A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G picture

A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G

$21.68



Dell Precision 3541 Laptop i5-9300H 2.4GHz 256GB SSD 16GB RAM Win 11 Pro picture

Dell Precision 3541 Laptop i5-9300H 2.4GHz 256GB SSD 16GB RAM Win 11 Pro

$189.99



Microsoft Windows 11 Home 64-Bit USB Flash Drive + Key Retail Box - Original picture

Microsoft Windows 11 Home 64-Bit USB Flash Drive + Key Retail Box - Original

$39.88