1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error in Ubuntu C Compiler

Discussion in 'C++' started by creative, Mar 22, 2010.

  1. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    I am a new-bie into Ubuntu and when I try to run the following Program on Ubuntu using GCC:
    #include<stdio.h>
    #include<string.h>

    Code:
    int main()
    {
    char *name1 = "Creative";
    char *name2 = "Creative123";
    int op = strnicmp(name1,name2,6);
    printf("Hi Creativel!\n The output is: %d",op);
    return;
    } 
    i get the following error:

    Code:
    /tmp/ccydQH9l.o: In function `main':
    CProgram.c.text+0x31): undefined reference to `strnicmp'
    collect2: ld returned 1 exit status 
    I know this is a very trivial program in C, but still I am unable to find any erros in this. Will be great if someone could help me with this.
     
  2. techme

    techme New Member

    Joined:
    Feb 15, 2010
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    I think you have a spelling mistake. There is a strcmp and a strncmp function but not strnicmp.
     
  3. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    Thanks!
    :)
    Silly Mistake Was That!
     

Share This Page