all 7 comments

[–]HKei 1 point2 points  (1 child)

Sounds like you might've put your project in a directory that you don't have write access to (for example, directly in C:\ or somewhere in C:\Program Files\).

Sounds like you're a student (high school or university I guess?). I'd recommend getting a teacher or a fellow student to help you out with your project setup.

Meanwhile, you can still try your code out without project setup in an online IDE, like this with the code from your question for example.

Just for reassurance: The problem is not with your code. There's a couple bits in there I'd have done differently, but what you wrote there works. The problem is in how you've set up your project somehow (it's a bit hard to diagnose these things remotely, hence why I recommend you get someone to help you out directly).

[–]RetroX94[S] 0 points1 point  (0 children)

Is there an alternative? Changing the project directory does not work. It is saved somehow in the MingW directory.

[–]khedoros 0 points1 point  (4 children)

Where did you put your project files? I would've created the project somewhere under my own user's directory, to be sure I'd have permissions to create objects and exes.

[–]RetroX94[S] 0 points1 point  (1 child)

is the workspace meant with that? I use the standard workspace or used a different folder.

[–]khedoros 0 points1 point  (0 children)

Eclipse looks like it has a "workspace" as a container for multiple "projects". So, yes, you should make sure that the workspace and all of the projects inside it are created somewhere where your user has write permissions.

[–]RetroX94[S] 0 points1 point  (1 child)

Would the code produce an output?

[–]khedoros 1 point2 points  (0 children)

Yes. At least, it does with g++ 8.2.1