A newcomer to C++ and Cuda here, was going trough tutorials when VS 2012 started throwing errors at me.
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;
int main()
{
int n = 10;
while (n>0)
{
cout << n << endl;
n--;
std::this_thread::sleep_for (std::chrono::seconds(1));
}
system("pause");
}
This is the code, it works as a Win32 project but not as CUDA 6.5 project which throws out a “rvalue reference cannot be bound to an lvalue” and then a bunch of “expression must have arithmetic or enum type”, all in (+ some others). It also gives a a ton of warnings along the lines of:
Warning 5 The element 'ItemGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'CudaCompile' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Item, Reference, COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile, ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep, Manifest, ProjectConfiguration, ProjectCapability, NativeReference, ProjectReference, Compile, EmbeddedResource, Content, Page, Resource, ApplicationDefinition, None, BaseApplicationManifest, Folder, Import, Service, WebReferences, WebReferenceUrl, FileAssociation, BootstrapperFile, PublishFile, PRIResource, AppxSystemBinary, AppxReservedFileName, AppxManifestFileNameQuery, AppxManifest, StoreAssociationFile, CodeAnalysisDependentAssemblyPaths, CodeAnalysisDictionary, CodeAnalysisImport, Link, ResourceCompile, PreBuildEvent, PostBuildEvent' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 6.5.targets 67 14 Miscellaneous Files
The issue should be instantly replicable by copy-pasting the code in a VS 6.5 Cuda project, at least it’s that way for me. I have been looking for a solution to this for ages with no results.
It is of course possible that I’m missing something obvious but as mentioned I’ve recently switched to C++ from VB.
Let me know if you need more information and thanks for your time in advance.
EDIT: the thing seems to be working fine if added to one of the Cuda samples, but that doesn’t help really. I guess I’ll try reverting to 6.0
EDIT 2: The thing works on 6.0 which leads me to believe that 6.5 behavior isn’t intended. Is there somewhere I should report this or will it get noticed here if it’s really a bug?