Community
cancel
Showing results for 
Search instead for 
Did you mean: 
timminn
Beginner
86 Views

Problems on concurrent_vector with TBB 2.1 by VisualStudio2005sp1 under WinXP SP2

Jump to solution

I am currently usingTBB 2.1inVisualStudio2005sp1 under WinXP SP2, with the Intel official VS plug-in for TBB.

I am quite sureI has installed the TBBlibrary and the VS plug-in properly, and I have written some codes with TBB[not containing the concurrent_vector] that compiled and run successfullyin VS. And here is a special case I cannot solve nor can I find any reference from the turtorial or manual. It is playing withpointers to the concurrent_vector, compiled with debug version.

#include "tbb/concurrent_vector.h"
typedef tbb::concurrent_vector cvi;
class myc{
private: static cvi *s;
public: static void stat_init( cvi* );
};//myc
cvi myc::*s;
void myc::stat_init( cvi* ous ){ s=ous; }
int main( int argc, char *argv[] )
{
cvi c;
c.push_back(0);
myc obj;
myc::stat_init(&c);
return 0;
}//main() end

For the above piece of code, the VS compiler generates the message "Error1error LNK2001: unresolved external symbol "private: static class tbb::concurrent_vector > * myc::s" (?s@myc@@0PAV?$concurrent_vector@HV?$cache_aligned_allocator@H@tbb@@@tbb@@A)test.obj
" .

And, if Ichange all the pointersto objects as the following, compiling and linking will be no problem[also in debug versi], but it pops up with some errors message "msvcp80d.dll cannot be found."

#include "tbb/concurrent_vector.h"
typedef tbb::concurrent_vector cvi;
class myc{
private: static cvi s;
public: static void stat_init( cvi );
};//myc
cvi myc::s;
void myc::stat_init( cvi ous ){ s=ous; }
int main( int argc, char *argv[] )
{
cvi c;
c.push_back(0);
myc obj;
myc::stat_init(c);
return 0;
}//main() end

Could anyone help? Thank you. I have tried looking into the docs, but found no useful info.

0 Kudos
1 Solution
Dmitry_Vyukov
Valued Contributor I
86 Views
Try to declare static variable this way:
cvi* myc::s;

And this:
cvi myc::*s;
is a declaration of global variable of type pointer to member.


Btw, following:
void myc::stat_init( cvi* ous ){ s=ous; }
looks a bit senseless. Maybe you meant:
void myc::stat_init( cvi*& ous ){ s=ous; }
?

View solution in original post

6 Replies
Dmitry_Vyukov
Valued Contributor I
87 Views
Try to declare static variable this way:
cvi* myc::s;

And this:
cvi myc::*s;
is a declaration of global variable of type pointer to member.


Btw, following:
void myc::stat_init( cvi* ous ){ s=ous; }
looks a bit senseless. Maybe you meant:
void myc::stat_init( cvi*& ous ){ s=ous; }
?

View solution in original post

timminn
Beginner
86 Views
Thank you for your help. But the run-time error message "msvcp80d.dll not found" still keeps poping up
Dmitry_Vyukov
Valued Contributor I
86 Views
timminn:
Thank you for your help. But the run-time error message "msvcp80d.dll not found" still keeps poping up


You must enable manifest generation. Project Properties -> Linker -> Manifest file -> Generate Manifest -> Yes.
It must be enabled by default when you create new project.

timminn
Beginner
86 Views
Thank you again. But it does not work.
Dmitry_Vyukov
Valued Contributor I
86 Views
timminn:
Thank you again. But it does not work.


Check: Project Properties -> C/C++ -> Code Generation -> Runtime Library. There must be Multi-threaded Debug DLL for debug build, and Multi-threaded DLL for release build. You can get the error, if you are using static runtime.

Did you created new project from scratch? If no, try to create new project from scratch. Because on my MSVC2005SP1 it works perfectly.



timminn
Beginner
86 Views

You hit it! thank you.

Quoting - randomizer



timminn:

Thank you again. But it does not work.

Check: Project Properties -> C/C++ -> Code Generation -> Runtime Library. There must be Multi-threaded Debug DLL for debug build, and Multi-threaded DLL for release build. You can get the error, if you are using static runtime.

Did you created new project from scratch? If no, try to create new project from scratch. Because on my MSVC2005SP1 it works perfectly.


Reply