0

WIndows 7
Project framework : c++/CLR VS 2017

Issue: I have successfully linked static library into my project. SO I do not get any compilation error related to it. I have added header file of it in my cpp file as well.
But when I try to call functions from Static library compiler complains about it. I am wondering, Am I missing something ?

Just to note: I have tried to link static library & call its functions in my dummy project build under win32 and it compiles just fine So issue is related to C++/CLR.

Employee.obj : error LNK2028: unresolved token (0A000519) "extern "C" void __cdecl convertPensionToInvest(long,char,double,double,double *,double *,double *)" (?convertPensionToInvest@@$$J0YAXJDNNPEAN00@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Employee::convertRanAzEleToHtLatLon(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?convertRanAzEleToHtLatLon@Employee@@$$FQEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV23@00@Z)
    1>Employee.obj : error LNK2019: unresolved external symbol "extern "C" void __cdecl convertPensionToInvest(long,char,double,double,double *,double *,double *)" (?convertPensionToInvest@@$$J0YAXJDNNPEAN00@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Employee::convertRanAzEleToHtLatLon(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?convertRanAzEleToHtLatLon@Employee@@$$FQEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV23@00@Z)
Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
samprat
  • 2,150
  • 8
  • 39
  • 73
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Miles Budnek Jun 12 '19 at 09:54
  • @MilesBudnek, Thanks for the link , but i do not think this is duplication as I can successfully link static lib into my dummy project build under win32. Calling lib function is also fine. So issue is with C++/CLR. At least thats what i think – samprat Jun 12 '19 at 10:05
  • Do you mean C++/cli? – Matthieu Brucher Jun 12 '19 at 11:29
  • @MatthieuBrucher, I am new to this area but on VS2017 --> it shows C++->CLR when you choose the project – samprat Jun 12 '19 at 13:01
  • 1
    Maybe something in the lines of https://learn.microsoft.com/en-us/cpp/dotnet/walkthrough-compiling-a-cpp-program-that-targets-the-clr-in-visual-studio?view=vs-2019 is what you need. – Matthieu Brucher Jun 12 '19 at 15:14
  • @samprat first thing to check would be is linker actually linking in your static lib - have you added the static library as a project reference or as a linker input? If so, maybe you can post the full linker output. – Rudolfs Bundulis Jun 13 '19 at 07:52

0 Answers0