extern - linking error in MSVC++ 6

This is a discussion on extern - linking error in MSVC++ 6 within the C Programming forums, part of the General Programming Boards category; I've got a .cpp file with a function Code: LOAD_file(const char *szFileName) In the header file I have Code: #if ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,439
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 04:04 AM
  4. Trouble linking with extern
    By amoskoh in forum C++ Programming
    Replies: 4
    Last Post: 03-21-2005, 07:44 PM
  5. extern symbols, what do these mean exactly?
    By Shadow12345 in forum C++ Programming
    Replies: 8
    Last Post: 11-02-2002, 02:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21