Thread: extern - linking error in MSVC++ 6

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1

    extern - linking error in MSVC++ 6

    I've got a .cpp file with a function
    Code:
            LOAD_file(const char *szFileName)
    In the header file I have
    Code:
    #if defined __cplusplus 
    extern "C" {
    #endif
    
    BOOL LOAD_file(const char *szFileName);
    
    #if defined __cplusplus 
    }
    #endif
    I'm calling the function from a C file.

    Compilation is fine but during linkage I always get the error

    Code:
    error LNK2001: unresolved external symbol _LOAD_file
    I'm using MSVC++ 6.

    Can anyone tell me whats wrong?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Did you include the header in both the C++ and C source files?

    Is your main() in a C++ file?
    http://www.parashift.com/c++-faq-lit...c-and-cpp.html
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern const?Please help
    By huwan in forum C++ Programming
    Replies: 10
    Last Post: 08-12-2008, 04:53 AM
  2. extern classes
    By Swordsman in forum C++ Programming
    Replies: 1
    Last Post: 05-07-2008, 02:07 AM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Trouble linking with extern
    By amoskoh in forum C++ Programming
    Replies: 4
    Last Post: 03-21-2005, 08:44 PM
  5. extern symbols, what do these mean exactly?
    By Shadow12345 in forum C++ Programming
    Replies: 8
    Last Post: 11-02-2002, 03:14 PM