Thread: LNK1005: symbol already defined (DLL import)

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    1

    LNK1005: symbol already defined (DLL import)

    Hello,

    after days of searching, I couldn't find my problem anywhere else, so i hope you can help me with it.

    I am trying to import a DLL like this:



    Read.h:

    Code:
    #define _WIN32_DCOM		
    
    #define USING_WRAPPER_CLASS
    #include "dll.h"
    class ReadData
    {...
    }
    dll.h:

    Code:
    #if 1
    
    #ifdef USING_WRAPPER_CLASS
    #import "Read.dll" no_namespace named_guids
    #else
    
    #import "Read.dll" no_namespace, raw_interfaces_only,\
                       raw_native_types, named_guids
    #endif
    
    #else
    
    #include "Read.tlh"
    
    #endif
    
    void CheckHRESULT(HRESULT hr, char* str = NULL)
    {
    	if( SUCCEEDED(hr) ){
    		if( str )printf("%s\n\r",str);
    		else printf("Success!\n\r");
    	}
    	else printf("Failed...(0x%08X)\n\r",hr);
    }
    Read.cpp:

    Code:
    #include "ReadData.h"
    
    ReadData::ReadData(void)
    {...
    }
    So far it works fine, but when I am going to include the Read.h in some other *.cpp file, I get the Linker-Error mentioned above.

    I hope I explained the problem enough, I really dont know how to solve it.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why do you have code in a .h file?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL generated but related import library is missing?
    By George2 in forum C Programming
    Replies: 0
    Last Post: 08-18-2006, 12:13 AM
  2. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  3. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM
  4. Header files
    By borland_man in forum C++ Programming
    Replies: 14
    Last Post: 02-22-2002, 04:30 AM
  5. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 12:02 PM