lnk2019 error for KERNEL32.LIB symbol

hello all,
i am porting a vc6 project to vc8 and after rebuilding all my old libs
i still get 2 lnk2019 errors for symbols that should be in KERNEL32.LIB:

i checked linking with linker option "/verbose" and also checked my old
program using vc6 where it finds the two symbols in KERNEL32.LIB, no problem

these are my error messages:
1.
hblib_d.lib(mutex.obj) : error LNK2019: unresolved
external symbol
"__declspec(dllimport) long __stdcall InterlockedIncrement(long *)"
(__imp_ InterlockedIncrement@@YGJPAJ@Z) referenced in
function "public: int __thiscall ost::AtomicCounter::operator+=(int)"
( YAtomicCounter@ost@@QAEHH@Z)

2.
hblib_d.lib(mutex.obj) : error LNK2019: unresolved
external symbol
"__declspec(dllimport) long __stdcall InterlockedDecrement(long *)"
(__imp_ InterlockedDecrement@@YGJPAJ@Z) referenced in
function "public: int __thiscall ost::AtomicCounter::operator-=(int)"
( ZAtomicCounter@ost@@QAEHH@Z)

.\ddptestCORBA_2005_Debug\ddptestCORBA.exe : fatal
error LNK1120: 2 unresolved externals

thank you all
stefan


Answer this question

lnk2019 error for KERNEL32.LIB symbol

  • Rob Caron MSFT

    No! This can't be the reason. If the signature is correct and KERNEL32.LIB is in the list of libraries to be included it should work.

    Do you can create a small sample to repro this problem



  • Zebes

    OK i found a solution, but i dont understand it.

    The method using these function InterlockedIncrement &
    In..Decrement is are two operators:
    operator+= and operator-=.
    There are several other
    operators within the same Class using these two
    functions InterlockedInc., etc, but they are all INLINE functions and also there implementaion is within the
    HEADER file.
    Now i changed the += and -= operators to inline and
    moved them from the .CPP to the .H file and everything
    works fine.
    BUT WHY, can please somebody tell me...

    thanks a lot
    stefan




  • Eric Yin

    (so you can read it better:-))
    hello all,
    i am porting a vc6 project to vc8 and after rebuilding
    all my old libs
    i still get 2 lnk2019 errors for symbols that should
    be in KERNEL32.LIB:

    i checked linking with linker option "/verbose" and
    also checked my old
    program using vc6 where it finds the two symbols in
    KERNEL32.LIB, no problem

    these are my error messages:
    1.
    hblib_d.lib(mutex.obj) : error LNK2019: unresolved
    external symbol
    "__declspec(dllimport) long __stdcall
    InterlockedIncrement(long *)"
    (__imp_ InterlockedIncrement@@YGJPAJ@Z) referenced in
    function "public: int __thiscall
    ost::AtomicCounter::operator+=(int)"
    ( YAtomicCounter@ost@@QAEHH@Z)

    2.
    hblib_d.lib(mutex.obj) : error LNK2019: unresolved
    external symbol
    "__declspec(dllimport) long __stdcall
    InterlockedDecrement(long *)"
    (__imp_ InterlockedDecrement@@YGJPAJ@Z) referenced in
    function "public: int __thiscall
    ost::AtomicCounter::operator-=(int)"
    ( ZAtomicCounter@ost@@QAEHH@Z)

    .\ddptestCORBA_2005_Debug\ddptestCORBA.exe : fatal
    error LNK1120: 2 unresolved externals

    thank you all
    stefan

  • lnk2019 error for KERNEL32.LIB symbol