Did you manage to compile?

Didnt work

Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

d:\Michael\Programming\Beginner>cl hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hello.cpp
Microsoft (R) Incremental Linker Version 14.13.26129.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj
LINK : fatal error LNK1561: entry point must be defined

as you can see i got a fatal error

saving the file first fixed it

4 Likes

I got the program to compile. Simple program with clear instructions. :+1:

When I try to compile the code for the first time it seems to compile but I get a warning.
When I try to run the exe it says access denied and my antivirus software gives me a warning and deletes the exe.
When I try to compile again it doesnā€™t work anymore and I get a Linker error ā€œLINK : fatal error LNK1104: cannot open file ā€˜hello.exeā€™ā€

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.9
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************

c:\UneralCPPTutorial>cl hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xlocale(319): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj

c:\UneralCPPTutorial>hello
Access is denied.

c:\UneralCPPTutorial>cl hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xlocale(319): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj
LINK : fatal error LNK1104: cannot open file 'hello.exe'

Does anyone know how to get this to work?
Thanks

compilation went ok, but afterwards i am not able to delete the .exe file! (win 10) it says access denied. i have to ask user (my own admin user i am logged in as) for permissionā€¦ no way to authenticate againā€¦

i am now unable to get rid of the fileā€¦

Welcome @Bitefish and @KnitterX to the community!

I had no problem compiling.

1 Like

pretty sure thatā€™s because itā€™s using normal windows console not developer console Donā€™t remember how I fixed it but itā€™s not hard

It seems to work now except that I got the warning C4530 I just have no idea why it works now

(Edit
actually now I know why it works I added Windows 10 SDK both of them since I did add one before but it didnā€™t fix it
)

#include <iostream>

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

also I added Hello world there

No, it was the right console. The problem was that my anti virus software was blocking it.
I had to add the project folder to the exceptions.

When I am trying to compile I keep on getting the error message
ā€œLINK : fatal error LNK1104: cannot open file ā€˜kernel32.libā€™ā€
Does anyone know what is wrong?

Yes, I was able to compile it!

Hello @Jamie_Greenaway , I think I am getting a similar error as you.
Using VS Code on windows 10 64. Please see the screenshot. Any help?

Iā€™m using Mac and the
g++ hello.cpp -o hello
and then
./ hello
part didnā€™t work for me. anyone know why?

Yeah thatā€™s the exact same error

No, I was not able to compile. When I entered ā€œcl hello.cppā€ it came in the terminal " ā€˜clā€™ is not recognized as an internal or external command, operable program or batch file."
How do I resolve this?

1 Like

Yep, got hello.cpp to compile. Because I had VS 2017 Enterprise installed, I had to find the 2019 command prompt, and then followed the prefernces>settings>shell, and included the line to find the buildtools cmd.

hello there ā€¦ i satrted new here but i got an error
ā€œLINK : fatal error LNK1181: cannot open input fileā€. . how can i fix it ā€¦ its in the compilar in VS code

Hello word First COMPLETE Begigner test

Code:-
#include

int main()

{

std::cout << ā€œHello World, Brian.\nā€;

return 0;

}

t Executing task in folder Unreal Engine Code: msbuild /property:GenerateFullPaths=true /t:build <

ā€˜msbuildā€™ is not recognized as an internal or external command,
operable program or batch file.
The terminal process command ā€˜C:\Windows\system32\cmd.exe /d /c msbuild /property:GenerateFullPaths=true /t:buildā€™ failed to launch (exit code: 1)

Terminal will be reused by tasks, press any key to close it.

1 Like

I was not able to do it. When I press enter windows appears asking which app I want to use to open the hello.cpp file. I did chose Visual Studio Codeā€¦ now when I type hello.cpp I just get a new line of my directory where hello.cpp is. sorry if its a silly question

1 Like

Privacy & Terms