Intro "Hello, World" not working for me

In the early section of the C++ course for unreal I am running into issues. I am brand new to C++ and could really use extensive explanations. The code is:

#include <iostream>

int main()

{

    std::cout << "Hello, World";

    return 0;

}

When I go to terminal and type “cl triplex.cpp” I receive:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\ostream(746): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
triplex.cpp(5): note: see reference to function template instantiation ‘std::basic_ostream<char,std::char_traits> &std::operator <<<std::char_traits>(std::basic_ostream<char,std::char_traits>
&,const char *)’ being compiled

and when I type " cl triplex.exe" I receive the error:

LINK : fatal error LNK1149: output filename matches input filename

I am on windows using visual studio code. Can anyone tell me where I made a mistake or how I can fix this?Preformatted text

Hi,
First, welcome to the course.

The command should be cl triplex.cpp and it creates the exe file for you, assuming your source is in triplex.cpp of course.

I hope this helps.

This is the correct command and what you showed shows no errors. It compiled successfully.
By default cl will name the output the executable as the same name as the file. i.e. what you typed would output triplex.exe.

You aren’t supposed to type that. What you’re trying to do there is compile triplex.exe (which doesn’t make sense) but also output a file called triplex.exe, hence the error message.

To run the program just type the name i.e. triplex.exe

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms