From this post, I need to export function ci_find_substr
, so in my header file, i declare function:
template<typename Twst>
__declspec(dllexport) int ci_find_substr (const Twst& str1,const Twst& str2 ,
const std::locale& loc = std::locale());
but when compile this code from another project:
int k=ci_find_substr (wstring(mycstring), wstring(L".doc");
I get an error Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "int __cdecl ci_find_substr (class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::locale const &)" (?ci_find_substr @@YAHV?$basic_string@_WU?$char_traits@_W@std@@V?
I also tried the same thing in this post
template<typename Twst>
int ci_find_substr (const Twst& str1,const Twst& str2,
const std::locale& loc = std::locale());
__declspec(dllexport) int ci_find_substr (const wstring& str1,const wstring& str2,
const std::locale& loc = std::locale()); // Explicit instantiation
But still no success! Where did I go wrong? How do I fix my code?