我试图学习用C ++编程,因为我现在几乎不懂语言。我下载了Visual Studio Express 2017并制作了一个非常简单的HelloWorld.cpp
文件,但是我收到了如下所示的错误。
我已多次检查语法,但我没有在代码本身看到错误,这让我相信安装本身可能存在问题。但是,由于我对VSE很新,我甚至不知道从哪里开始解决这个问题。如果你能伸出援助之手,那就太好了。
错误消息:
[3/24/2018 6:49:30 PM Error] System.ArgumentNullException: Value cannot be null.
Parameter name: solutionDirectory
at Microsoft.VisualStudio.TestPlatform.ObjectModel.ValidateArg.NotNull[T](T arg, String parameterName)
at Microsoft.VisualStudio.TestWindow.Controller.TestRunConfiguration..ctor(TestContainerConfigurationQuery testRunQuery, String resultsDirectory, String solutionDirectory, Boolean ignoreDiscovery, ILogger logger, Boolean keepAlive)
at Microsoft.VisualStudio.TestWindow.Controller.RequestConfigurationFactory.CreateTestRunConfigurationBase(TestContainerConfigurationQuery query, Boolean ignoreDiscovery)
at Microsoft.VisualStudio.TestWindow.Controller.RunAllOperation.CreateRunConfiguration()
at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.get_RunConfiguration()
at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<ExecuteInternal>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Controller.Operation.<ExecuteWithEvents>d__40.MoveNext()
代码本身,如果你想确认它没有任何问题:
// HelloWorld.cpp
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
答案 0 :(得分:1)
问题不在于你的代码。安装也应该没问题。我相信你没有正确设置你的C ++项目。请参阅this tutorial,其中阐述了如何在Visual Studio 2017中生成有效的C ++ Hello World项目的每个步骤。