Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • anineOctober 25, 2008 8: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 FilesIntelTBB2.1includetbbparallel_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 9:08 AM PDT
    Rate
     
    Re: VC++ language CLR windows form with TBB? (error C2695)

    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.

     



    anineOctober 27, 2008 8:12 PM PDT
    Rate
     
    Re: VC++ language CLR windows form with TBB? (error C2695)

    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 6:59 AM PDT
    Rate
     
    Re: VC++ language CLR windows form with TBB? (error C2695)

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



Forum jump:  

Intel Software Network Forums Statistics

16,376 users have contributed to 46,363 threads and 164,030 posts to date.

In the past 24 hours, we have 11 new thread(s) 28 new posts(s), and 25 new user(s).

In the past 3 days, the most popular thread for everyone has been Program compiles in release but not debug The most posts were made to You need to show us the whole The post with the most views is try_pop in concurrent_queue

Please welcome our newest member fruitbrown


For more complete information about compiler optimizations, see our Optimization Notice.