COM library and linking error

This is a discussion on COM library and linking error within the Windows Programming forums, part of the Platform Specific Boards category; hello everybody. i have been thrown into the wonderful world of windows development recently, and although there has been a ...

  1. #1
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155

    COM library and linking error

    hello everybody.

    i have been thrown into the wonderful world of windows development recently, and although there has been a few stumbling blocks it has been good so far.

    i am currently working on a COM library (COM & ATL with VS 2003) it contains several (5) coclasses that each implement a number of different interfaces. to test this library i have a separate vc++ solution in which i use CppUnit to unit test each of the classes. this has been working great so far.

    i recently added a utility class to the COM project, which is just a regular c++ class, no COM or ATL magic involved. The Util class works fine from within the project, but when I try to use it in the CppUnit project I get linker errors. It seems as if the Util class is not being made available through the .lilb or dlls that are created by the main project.

    I suppose my questions are.
    1) Is this approach COM'ish, or is there a better way to create a util class in COM.
    2) If this approach is acceptable, do I have to apply some sort of dll magic (or something like that) to make this class available when linking from other projects?

    I can provide more explanation if necessary.

  2. #2
    xhi
    xhi is offline
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    a short update.. first i realized i forgot to post the error (doh!)..
    Code:
    NTDSUtilTestCase.obj : error LNK2019: unresolved external symbol "public: static long __cdecl NTDSUtil::ValidateDTGString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)  referenced in function "public: void __thiscall NTDSUtilTestCase::ValidateDTG_ValidDTG(void)" (?ValidateDTG_ValidDTG@NTDSUtilTestCase@@QAEXXZ)
    Debug/CPPUnit_Test.exe : fatal error LNK1120: 1 unresolved externals
    so. i tried to make the util class a plain ATL object (instead of a plain c++ class), and it gives the same linking error as the plain c++ class..

    also, if i move the function definitions to the header file, it links just fine. i am apparently missing something in either linking in the client or in building the util.dll ..

    any ideas? anything at all is welcomed, i am new to all this win32-fu..

    thanks for your time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-29-2009, 07:42 AM
  2. strange linking error -- can not find shared library
    By George2 in forum C Programming
    Replies: 2
    Last Post: 07-10-2006, 11:51 PM
  3. Linking Error (libc.lib)
    By gpr1me in forum Game Programming
    Replies: 0
    Last Post: 03-30-2006, 01:28 PM
  4. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  5. Linking error using ODBC with C and BCC32
    By D@nnus in forum C++ Programming
    Replies: 0
    Last Post: 11-17-2001, 05:11 AM

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