2012ssohn
2012ssohn

Reputation: 159

HelloWorld.cpp can't Compile

I'm trying to learn to program in C++ since I hardly know the language at the moment. I downloaded Visual Studio Express 2017 and made a very simple HelloWorld.cpp file, but I get the error as shown below.

I've checked the syntax multiple times, but I don't see an error in the code itself, which makes me believe there may have been a problem in the installation itself. However, since I am very new to VSE, I don't even know where to begin fixing this issue. If you could lend me a hand, that would be great.

The error message:

[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()

The code itself, if you want to confirm there is nothing wrong with it:

// HelloWorld.cpp

#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

enter image description here

Upvotes: 0

Views: 270

Answers (1)

BobMorane
BobMorane

Reputation: 4296

The problem is not with your code. The installation should be OK also. I believe you did not set up your C++ project correctly. See this tutorial, which explicits every steps on how to generate a valid C++ Hello World project in Visual Studio 2017.

Upvotes: 1

Related Questions