Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
581 Discussions

DPL functions cannot be correctly linked, is there any other lib required?

shenuo
Employee
1,261 Views

Here is my code:

#include <CL/sycl.hpp>
#include <vector>
#include <iostream>
#include <oneapi/dpl/algorithm>
#include <algorithm>

using namespace sycl;

int main(int argc, char* argv[]) {

std::vector<int> a;
a.resize(100);

oneapi::dpl::fill(oneapi::dpl::execution::par_unseq,a.begin(),a.end(),3);

return 0;
}

error LNK2019: unresolved external symbol "void __cdecl oneapi::dpl::fill<class oneapi::dpl::execution::v1::parallel_unsequenced_policy const &,class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >,int>(class oneapi::dpl::execution::v1::parallel_unsequenced_policy const &,class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >,class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >,int const &)" (??$fill@AEBVparallel_unsequenced_policy@v1@execution@dpl@oneapi@@V?$_Vector_iterator@V?$_Vector_val@U?$_Simple_types@H@std@@@std@@@std@@H@dpl@oneapi@@YAXAEBVparallel_unsequenced_policy@v1@execution@01@V?$_Vector_iterator@V?$_Vector_val@U?$_Simple_types@H@std@@@std@@@std@@1AEBH@Z) referenced in function main

my programing environment :

VS2017

oneAPI DPC++ Compiler  (2021.3.0)

windows 10

Labels (1)
0 Kudos
1 Solution
shenuo
Employee
1,254 Views

problem solved. must contain the <dpl/excution>header, Besides, the tbb.lib also requires to be linked. I didn't found this point mentioned in the tutorial.  o_o

View solution in original post

0 Kudos
4 Replies
shenuo
Employee
1,255 Views

problem solved. must contain the <dpl/excution>header, Besides, the tbb.lib also requires to be linked. I didn't found this point mentioned in the tutorial.  o_o

0 Kudos
ArpitaP_Intel
Moderator
1,234 Views

Hello,

 

Thanks for reaching out to us.

 

Glad to know your issue is resolved. It would be a great help if you let us know the tutorial document you are referring.

 

Thanks!

 

0 Kudos
shenuo
Employee
1,223 Views
0 Kudos
ArpitaP_Intel
Moderator
1,192 Views

Hello,


You can get the detailed steps in the below URL

https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-library-guide/top/parallel-stl-overview/parallel-stl-usage.html


As your issue is resolved, we are going ahead and closing this thread. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks!



0 Kudos
Reply