Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
anine
Total Points:
70
Status Points:
20
Green Belt
October 25, 2008 7:41 PM PDT
VC++ language CLR windows form with TBB? (error C2695)

I meet a question. When I write a TBB program in console mode. It is running normally.But when I write a TBB program in clr windows form(this program is the same code under clr windows form and console mode). The compiler appear in the wrong information(error C2695).

 " \Program Files\Intel\TBB\2.1\include\tbb\parallel_for.h(59) : error C2695
 function1' overriding virtual function differs from 'function2' only by calling convention".
 Where function1 is 'start_for<Range,Body,Partitioner>::note_affinity' and  function2  is 'tbb::task::note_affinity'.

This problem confuse me. Does any reason cause this question? How should I solve it?

                                                                                                                           Thank you

Andrey Marochko (Intel)
October 27, 2008 8:08 AM PDT
Rate
 
#1

I'm not completely sure that this will help, but for the sake of experiment try to do the following:

  • Open file "tbb/parallel_for.h"
  • Find the line:
    /*override*/ void note_affinity( affinity_id id ) {
  • Change it to
    /*override*/ void __TBB_EXPORTED_METHOD note_affinity( affinity_id id ) {
  • Save the changed file
  • Rebuild your application

And, please, write us if it helped or not.

 



anine
Total Points:
70
Status Points:
20
Green Belt
October 27, 2008 7:12 PM PDT
Rate
 
#2 Reply to #1
Thanks for your answer. I followed your method to change codes in tbb/parallel_for.h. There is still a mistake(C3641). This mistake is a question about  '/clr:pure' and 'calling_convention'.
I only hope to change the following procedure from CLR console mode into CLR window form.
I am so unexpected that the problem is happen.
Maybe I have not noticed some details of CLR windows form.
class Average{
 float* input;
 float* output;
 size_t size;
 public:
  void operator () (const blocked_range<size_t> & r) const {
   for(size_t i = r.begin(); i != r.end(); i++){
    if(i == 0)
     output[i] = (input[i] + input[i] + input[i+1])/3;
    else if(i == (size-1))
     output[i] = (input[i-1] + input[i] + input[i])/3;
    else
     output[i] = (input[i-1] + input[i] + input[i+1])/3;
    
   }
  } // end operator()
     Average(float _i[], size_t _s, float _o[]) : input(_i), size(_s), output(_o) {} //constructor + initial setup
 };

 



Andrey Marochko (Intel)
October 30, 2008 5:59 AM PDT
Rate
 
#3 Reply to #2

OK, I see what was the reason of your problem. You attempt to compile your .Net app in the "/clr:pure" mode. This won't work with the native library like TBB. Use the simple "/clr" option to compile your project. (And do not forget to remove that __TBB_EXPORTED_METOD qualifier from the "parallel_for.h" you've added recently.)





Intel Software Network Forums Statistics

6668 users have contributed to 28284 threads and 87461 posts to date.
In the past 24 hours, we have 6 new thread(s) 35 new posts(s), and 50 new user(s).

In the past 3 days, the most popular thread for everyone has been Fortran and Matlab The most posts were made to Larger Test Data The post with the most views is Quoting - nabeels Hello e

Please welcome our newest member karolbe