Thread: undefined symbol

  1. #1
    Registered User
    Join Date
    Aug 2002

    undefined symbol

    Im getting an error that says

    >Undefined first referenced
    > symbol in file
    >stricmp num.o

    when i test my code, but it compiles all ok and exectutes ok. Any ideas why?

    This is how ive used it:

    if(stricmp(cmd, word2) == 0)
    And i have included string.h


  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    What do you mean by when you test your code? You stated that it compiles and exicutes ok. If you have an error like that it most certaintly would not link ok. Therefore not exicute ok.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  3. #3
    Registered User
    Join Date
    Mar 2003
    The root problem is that stricmp() should be strcmp().

    The file may well compile as the compiler may assume that stricmp() is a function that is defined in another file. When it comes to linking you get the error you are seeing 'cos the linker can't find the function the compiler assumed it would.

    You should not be getting an executable to be able to say it executes ok. Are you sure you are not using an old executable?

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    >>The root problem is that stricmp() should be strcmp().
    stricmp is a non-standard case insensitive compare. It is available on some compilers. IMHO, it is better to write your own function to do the same, that way you can keep it portable and won't run into compile troubles like you are now.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM