Search code examples
c++visual-c++lnk2019

LNK2019 for inline function in static library


I'm trying to use an inline function from a static lib, but I get

error LNK2019: unresolved external symbol _ippsExp_64f@12 referenced in function "double __cdecl IppExp(double const &)" (?IppExp@@YANABN@Z)

Here's my code:

IppWrapper.h (project A)

#include <ippcore.h>
#include <ipps.h>
#include <ippvm.h>

inline double IppExp(const double& a)
{
   Ipp64f y;
   IppStatus s = ippsExp_64f(&a, &y, 1);
   return y;
}

main.cpp (A.lib is added)

#include "IppWrapper.h"

int main() 
{
   double d = IppExp(2.3);
}

dumpbin /symbols also don't receive my func. What am I missing?


Solution

  • Your inline function has nothing to do with the error you get. The error is about referencing the ippsExp_64f function. You need to link your code against code containing this function. If it's not your code but an external library, add the .lib file to your linker sources.