سؤال

I am trying to solve the following issue: I've got a library which uses C++Amp. The library compiles without any warnings and the unit-tests indicate that everything is working. I have a QT-based project which is a GUI for this library and here the problems begin. Everytime I am compiling the GUI, in the linking stage a get the following errors:

widgets.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: unsigned short const * __cdecl Concurrency::accelerator::_Get_device_path(void)const " (_imp?_Get_device_path@accelerator@Concurrency@@AEBAPEBGXZ) referenced in function "void __cdecl `dynamic initializer for 'public: static class std::_Future_error_category std::_Future_error_object::_Future_object''(void)" (??__E?_Future_object@?$_Future_error_object@H@std@@2V_Future_error_category@2@A@@YAXXZ)

The library is linked to lib file, not dll.

Same story goes for other object files in the project. Did anyone have a similar problem at the linking stage when using C++Amp. I am sure that it is a very simple problem to solve but at the moment I have no idea how I could do it. Thanks in advance.

Update: the same happens when I am trying to include in the QT project in MSVC++.

هل كانت مفيدة؟

المحلول

  __imp_?_Get_device_path@accelerator@Concurrency@@AEBAPEBGXZ

Running the undname.exe utility on that string to unmangle the name, I get:

  declspec(dllimport) private: 
  unsigned short const * __ptr64 
  __cdecl Concurrency::accelerator::_Get_device_path(void)const __ptr64

So it is 64-bit code. Looking in vc/lib/amd64/vcamp.lib for a closest match, I find:

 ?_Get_device_path@accelerator@Concurrency@@AEBAPEB_WXZ

Which demangles with undname.exe to:

 private: 
 wchar_t const * __ptr64 
 __cdecl Concurrency::accelerator::_Get_device_path(void)const __ptr64

Note the discrepancy. Your function got compiled to return unsigned short*, the library function returns wchar_t*. You have a compiler setting wrong. Project + Properties, C/C++, Language, Treat WChar_t As Built in Type must be set to the default, "Yes".

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top