#I started with c++, but i cant run "Hello Wolrd". It just wont run

116 messages · Page 1 of 1 (latest)

unkempt estuary
#

Every time i run it it just gives me this:
PS C:\Users\isido\Programaming\Cpp.vscode> & 'c:\Users\isido.vscode\extensions\ms-vscode.cpptools-1.21.6-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-tlvh51ud.ecs' '--stdout=Microsoft-MIEngine-Out-q2a3xbzb.cgn' '--stderr=Microsoft-MIEngine-Error-qwnlclfo.0vx' '--pid=Microsoft-MIEngine-Pid-eynbcejp.wjf' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'
PS C:\Users\isido\Programaming\Cpp.vscode> ^C
PS C:\Users\isido\Programaming\Cpp.vscode>
PS C:\Users\isido\Programaming\Cpp.vscode> & 'c:\Users\isido.vscode\extensions\ms-vscode.cpptools-1.21.6-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-qocw5rvv.45o' '--stdout=Microsoft-MIEngine-Out-bmt0zdwc.oum' '--stderr=Microsoft-MIEngine-Error-5wd4qypy.io5' '--pid=Microsoft-MIEngine-Pid-xnov1iib.k1x' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'
PS C:\Users\isido\Programaming\Cpp.vscode>

rustic narwhalBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

autumn frigate
#

Since you’re on Windows, it’s heavily recommended you use Visual Studio instead of Visual Studio Code. Visual Studio is a lot easier to set up and use especially for beginners

unkempt estuary
#

where do i find that

autumn frigate
#

Look up Visual Studio community online

#

Here are the steps for setting it up

rustic narwhalBOT
#
Getting Started With Visual Studio

New here and looking to quickly get started with C or C++ on Windows? Follow the steps in this thread to compile and run your first bits of code in Visual Studio.

autumn frigate
#

If you’re confused about anything don’t hesitate to ask

unkempt estuary
rustic narwhalBOT
#

@unkempt estuary Has your question been resolved? If so, type !solved :)

unkempt estuary
autumn frigate
#

Did you follow the steps? I use MSVC as the compiler for Visual Studio and it works fine

unkempt estuary
#

i did follow the steps

unkempt estuary
# autumn frigate Did you follow the steps? I use MSVC as the compiler for Visual Studio and it wo...

on vs code i get this
PS C:\Users\isido\Programaming\Cpp.vscode> & 'c:\Users\isido.vscode\extensions\ms-vscode.cpptools-1.21.6-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-gegcoo1f.bkq' '--stdout=Microsoft-MIEngine-Out-bop1fsww.1pr' '--stderr=Microsoft-MIEngine-Error-thjpjsan.iw0' '--pid=Microsoft-MIEngine-Pid-kcw1acz3.ubn' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'
PS C:\Users\isido\Programaming\Cpp.vscode> ^C
PS C:\Users\isido\Programaming\Cpp.vscode>
PS C:\Users\isido\Programaming\Cpp.vscode> & 'c:\Users\isido.vscode\extensions\ms-vscode.cpptools-1.21.6-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-zhnma1gz.kud' '--stdout=Microsoft-MIEngine-Out-cvzuccov.ps4' '--stderr=Microsoft-MIEngine-Error-3cyonl2n.k2q' '--pid=Microsoft-MIEngine-Pid-y5ibrqhn.zeg' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'

And on VS it just dosent run

eternal lantern
#

VS should be easier to configure

#

I do think that VSC is better, but it's harder to configure, and VS is definitely not broken

#

If you want to continue with VSC, try to compile and run directly in the terminal first, and see if that works. You know how to do that?

unkempt estuary
#

I can good it though

eternal lantern
#

? You mean you can google?

#

Try g++ my_file.cpp to compile, then .\a.exe to run

#

Tell what happens

unkempt estuary
#

That works

#

But only in powershell

#

In VS Code the output gets sent into the debug console

eternal lantern
#

So it does run in VSC

#

The problem is solved?

unkempt estuary
#

Yeah but how do i get it on the terminal

#

?

eternal lantern
#

Why does it matter?

#

You could uses tasks.json to run your executable, that would put it on the terminal

ivory anchor
ivory anchor
rustic narwhalBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

hidden shard
#
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "gcc",
            "args": [
                "*.cpp",
                "-o",
                "${workspaceFolder}\\Build\\app.exe",
                "-g",
                "-Wall",
                "-Wextra",
                "-Wpedantic"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

This was my tasks.json file, this basically compiles all cpp files in the directory you run the task from, and then outputs an app.exe into a directory called Build

#

it also turns on some extra warnings that can be useful

echo trail
#

It was more learning but it was worth it

hidden shard
#

Especially when you don't even need to know all of that to do anything because you'll need to use some kind of build system anyways instead of some crappy code runner/visual studio code tasks

eternal lantern
#

Also your VSC knowledge applied to any OS and compiler, it doesn't lock you to Windows+MSVC

echo trail
#

You could use notepad doesn’t matter

#

And if people are getting scared of setting up vscode, are they really ready to program in c++?

hidden shard
#

but saying "vsc setup better" isnt helping anyone, while recommending visual studio helps the beginner kickstart

hidden shard
#

and if something you should be recommending cmake with vsc because there is no real scenarion where vsc tasks are used

echo trail
#

I wish I used vscode

#

And I wasn’t just saying vscode was better

#

I was just saying I would prefer it as you get more experience with gcc

#

Visual studio is more confusing than vscode by a landslide

#

I think the build configuration in visual studio is atrocious

hidden shard
hidden shard
hidden shard
hidden shard
#

but they dont

#

they want to write and build c++ and they naively go into vscode because thats what they see online

echo trail
hidden shard
#

making a build script or vscode task is literally worthless because noone uses it

#

meanwhile msbuild is the default generator for cmake on windows

echo trail
#

You have no underlying point, the most popular compiler in the world in gcc, my point is I think it’s best for beginners to fully learn the underlying ways build tools generate build scripts for compilers, that is my point, just how some people say they wish they learned c rather than c#

#

I’m not even talking about vscode, I’m just talking about any text editor

hidden shard
echo trail
#

You are mistaken

hidden shard
#

nor vice versa so

echo trail
#

This is a pointless argument at this point, I’ve fully made clear my point and it can’t get any clearer, I respect your opinion though

hidden shard
#

literally anything else is wasted time

hidden shard
#

then they leave and the helpee doesnt progress one bit

#

setting up a shell script or something is just enforcing bad habits and its time spent that could be used for learning a build system that has cross platform support like cmake

echo trail
#

Ok yeah I understand that, i didn’t mean crap, I just meant a little overcomplicated, there are hundreds of options that I’ve seen scare people away, when you make your own build scripts you fully understand everything that’s going on, because, well you built them

hidden shard
#

I do agree that MSBuild is dogshit but for these guys a gui based build system is much better than writing scripts

#

and really the only thing you need to change in msbuild is like the c++ standard because its on c++14 by default i think

echo trail
#

Yeah, idk I’m just a little different ig, I really prefer writing my own. But I can def see why the majority of people prefer the gui

hidden shard
echo trail
#

Yeah

hidden shard
#

because thats hella janky and i would definitely consider using make or something at least (if you dont want to use cmake)

echo trail
#

I’m using cmake

hidden shard
#

okay well then its not a bash script yamikek

echo trail
#

Well I run cmake via a script

hidden shard
#

okay but that script isnt your build system

#

as opposed to some people having a build.sh that invokes gcc and stuff

stray tree
#

just get Visual studio

gritty harness
echo trail
#

That’s cool, i will check it out, thanks!

eternal lantern
eternal lantern
echo trail
#

gcc isnt even that slow, if you have a high-core cpu you can multithread compiling

ruby osprey
#

is it solved?

#

saw it, mb

hidden shard
hidden shard
#

idk i just did

#

the repo clearly states that it fails to build on windows thonk

#

thats not an msvc issue if they dont provide compat

#

what

#

i built it from cli with cmake too so

#

yes

#

oh wait imma try all too xd

#

but im pretty sure thats just the ALL project under vs

#

thats default on windows

#

and you dont need that for msvc anyways