Thread: problems with a C program on different machines, using different compilers

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    7

    problems with a C program on different machines, using different compilers

    Hi

    I have Fedora Core 5 2.6.17-1.2174_FC5 with gcc version: gcc (GCC) 4.1.1 200
    60525 (Red Hat 4.1.1-1)

    everything compiles well, and run smoothly on my machine. But the actual pro
    duction machine is Linux 2.4.20-46.9.legacysmp
    with gcc version gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

    on the production machine, I get errors like:
    1) warning #266: function declared implicitly
    while ((read = getline (&line, &len, sfile)) != -1) {

    2) undefined reference to `sem_init'
    3) undefined reference to `sem_destroy'

    while I am using the correct headers:
    #define _GNU_SOURCE
    #include <stdio.h>

    for the getline

    and
    #include <semaphore.h>

    for the sem_init and sem_destroy

    I receive the same "warning #266: function declared implicitly" for my own d
    efined functions as well, while my header is included,

    any ideas where could be the problem,

    sorry for asking a question that might be basic, but it is my first time to
    move code between different machines in linux and compilers versions,

    I appreciate any help,

    thanks,

    Manal

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Can't you update your GCC in the production machine?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    7
    Hi

    Thank you for your reply,

    I am trying to talk to the administrators to do this, but didn't get a reply yet, and I have deadlines to catch, and afraid they might say they can't because of other users might find it conflicting with their work,

    so, trying to plan for the worst actually, if there is any way I can fix my code to the older versions, I would like to learn it,

    thanks again,
    Manal

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    "getline" appears to be something like fgets, from the arguments, and the way you're using it, so why don't you just use that?


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Program calculation problems?
    By rebel in forum C++ Programming
    Replies: 7
    Last Post: 11-28-2005, 03:31 PM
  4. GPA Program Problems
    By Clint in forum C Programming
    Replies: 3
    Last Post: 04-28-2005, 10:45 AM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM