nsight error but compile and run complete

I’m using nsight and wanted to use c++11 cpu threads for some host code.

Any reference to threads here is about std::thread just to avoid any confusion. I’ve enable the c++11 option in settings and #include etc. I initially tried this with cuda 7.5 on Fedora 23 and then a fresh install of kubuntu and cuda 8. I’ve tried a clean c++ only project with a single main.cpp file to avoid any potential cuda issues.

I have a very strange problem where nsight gives me errors when I attempt to USE a thread.

I can declare a thread or launch one i.e.

std::thread some_thread(exmpleFunction, arg1, arg2, etc);

and all is good, nsight is ok with that, no errors. However, if I try to use the thread in any way,


for instance, I get an error that says there is no join() method, and I have no code completion either. However, the actual compile works and I can run the program. Whats even stranger, is if I try to create a vector of threads, e.g.

std::vectorstd::thread threads;
for (int i = 1; i <= some_limit; ++i)
threads.push_back(std::thread(exampleFunction, arg1, arg2, etc));

nsight complains that there is no method push_back() and yet it has no problem resolving this method for a vector of any other objects than threads.

I’ve also tried to update the indexes and all that but it didnt’ change anything.

The specific error messages are:

Method ‘push_back’ could not be resolved … Semantic Error
Method ‘join’ could not be resolved … Semantic Error

Any suggestions as to what magic I need to do to get nsight to NOT give me these errors would be greatly appreciated.


edit: I attached a screenshot of the contents of thread.h under the projects ‘Includes’ entry for /use/include/c++/5. Any idea what the / symbol means? I’m kind of guessing it means those things aren’t available maybe…? still can’t explain why it compiles and runs but nsight reports an error and i have no code completion.

so i followed the yellow brick road and discovered that if I define

__cplusplus=201304 (previously it was 199711)

then all of a sudden the errors go away and I have code completion.

I also get a warning that that symbol is redefined.

I did it all from scratch just to confirm that the macro expansion for that symbols is indeed 199711 in the thread.h header and this is WITH the enable c++11 option ticked and index rebuilt and everything else.

I don’t understand what on earth is going on. How can this all work? How can the application compile and run when the header doesn’t define the methods and why is that symbol set to 199711 in the first place and why doesn’t it change when I tick the enable c++11 tick box???

I must be missing something very very fundamental because none of this makes any sense to me.

I remember getting a lot of errors with Thrust’s vectors because they use inherited methods (a vector base class) and Nsight was unable to follow that.