TBB Linker error on vs2010 { "__declspec(dllimport) int __cdecl InitializeCriticalSectionAndSpinCount }

TBB Linker error on vs2010 { "__declspec(dllimport) int __cdecl InitializeCriticalSectionAndSpinCount }

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.

Regards

Avanindra Singh 

5 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hello Avanindra Singh

Do you use /nodefaultlib linker key? if yes you need to add Kernel32.lib to libraries.

--Vladimir

Hi Vladimir,

Thanks for the reply. I am not using  /nodefaultlib linker flag , though I tried explicitly to link Kernel32.lib , but the problem still persists.

Regards

Avanindra 

what is operation system and target SDK (_WIN32_WINNT macro setting)?

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 ). 

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!