Question

I have the following main.cpp file:

#include <amp.h>
using namespace concurrency;
int main()
{
  int arr[] = {42};
  array_view<int, 1> v(1, arr);
  return 0;
}

and a .pro file:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

QMAKE_CXXFLAGS += -EHsc
SOURCES += main.cpp

If I compile main.cpp from the Visual Studio 2012 command line (just using cl /EHsc main.cpp), everything works fine. But if I use qmake and nmake there is alway a link error, that there are unresolved external symbols (coming from amp). Does anybody know how to resolve this problem?

Was it helpful?

Solution

I figured out, what the problem is: In the mkspec file qmake.conf the compiler flag Zc:wchar_t- causes the compiler to translate some types relatet to wchar_t incorrectly and hence the resulting symbols could not be resolved.

To solve this problem, change the above .pro file to

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

QMAKE_CXXFLAGS += -EHsc -Zc:wchar_t
SOURCES += main.cpp

(add -Zc:wchar_t to QMAKE_CXXFLAGS).

OTHER TIPS

You forget to add

LIBS += -lname_of_the_amp_lib

Sorry but I don't know the name of the lib...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top