Hi All ,
I have written an image processing related code. I used TBB for parallel implementation of computationally intensive for loops. The program runs fine on Linux. I am trying to port it on windows. When I try to build the executable , I get following linker error:
Error 61 error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl InitializeCriticalSectionAndSpinCount(struct _RTL_CRITICAL_SECTION *,unsigned long)" (__imp_?InitializeCriticalSectionAndSpinCount@@YAHPEAU_RTL_CRITICAL_SECTION@@K@Z) referenced in function "int __cdecl inlineInitializeCriticalSectionEx(struct _RTL_CRITICAL_SECTION *,unsigned long,unsigned long)" (?inlineInitializeCriticalSectionEx@@YAHPEAU_RTL_CRITICAL_SECTION@@KK@Z) D:\projects\rocs_winmain\build\vs2010\release\test\feature_detection\vlfeat_interface.lib(affinefeaturedetector.obj)
I have linked the executable with tbb libraries ( tbb.lib , tbbmalloc.lib , tbbmalloc_proxy.lib ). What could I have to possibly link more to remove this linking error?...
The linking problem is coming from TBB only , because when I comment out the tbb implementation , my programs runs just fine.
Thanks for the reply. I am not using /nodefaultlib linker flag , though I tried explicitly to link Kernel32.lib , but the problem still persists.
I am using Windows 7 and I set explicitly _WIN32_WINNT to 0x0501 at the start of the cpp file before including tbb headers. I am using msvc 2010 , x64 . Also my program , uses OpenCV and vlFeat external libraries. Could the problem also come from external libraries ?.. I mean OpenCV has option of internally using TBB ( which I have disbled , it's compiled without TBB ).