Sửa lỗi an exception occurred no such file or directory năm 2024

Exact same thing happening to me. Tried with a fresh windows install, downloaded codeblocks-20.03mingw-setup.exe and can't even run the "Hello world" program. No weird file names, compiler directory is correct, everything that should be checked is checked

Logged

If you want help post a build log!

Tim S.

Logged

C Programmer working to learn more about C++ and Git. On Windows 7 64 bit and Windows 10 64 bit. -- When in doubt, read the CB WiKi FAQ. //wiki.codeblocks.org

-------------- Build: Debug in tyew [compiler: GNU GCC Compiler]---------------

g++.exe  -o bin\Debug\tyew.exe obj\Debug\main.o   
g++.exe: error: obj\Debug\main.o: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
Process terminated with status 1 [0 minute[s], 0 second[s]]
2 error[s], 0 warning[s] [0 minute[s], 0 second[s]]

There have been a few times after restarting my computer when i was able to run a program. Once the time comes when i can't run a program it stays like that forever until i restart my computer. Around 20% of my restarts result in me being able to run a program 1-3 times before everything goes to shit and i have to restart

« Last Edit: September 17, 2021, 09:16:32 am by Poruks »

Logged

Do you have any antivirus or temporary-files-cleaning software installed and possibly running/checking regularly?

Please press the Rebuild button [2 circling arrows] and post the full build log for that.

Logged

-------------- Clean: Debug in fhghgh [compiler: GNU GCC Compiler]---------------

Cleaned "fhghgh - Debug"

-------------- Build: Debug in fhghgh [compiler: GNU GCC Compiler]---------------

g++.exe  -o bin\Debug\fhghgh.exe obj\Debug\main.o   
g++.exe: error: obj\Debug\main.o: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
Process terminated with status 1 [0 minute[s], 0 second[s]]
2 error[s], 0 warning[s] [0 minute[s], 0 second[s]]

I have no anti-virus installed. Tried turning off everything in Windows Security Centre and it didn't do anything

I am trying to run a very simple Python program in VS Code. In the same subfolder I have the two following files:

  • 10-1_learning_python.py
  • learning_python.txt

This is the code in "10-1_learning_python.py":

filename = 'learning_python.txt'
with open[filename] as file_content:
    content = file_content.read[]
    print[content]

When running the code I get this error:

FileNotFoundError: [Errno 2] No such file or directory: 'learning_python.txt'

This code works [using the very same directory and files] if I run it in other applications such as SublimeText.

I am using VS Code for C and C++ but whenever I try to compile and run the code I always get this error statement:

bash: ./trya.cpp: No such file or directory.

I have tried various command lines before but nothing seems to work.

What's going on here? How can I fix this?

wovano

4,7395 gold badges24 silver badges50 bronze badges

asked Aug 21, 2021 at 9:10

1

Firstly, the file trya.cpp is inside Documents directory. I think in the terminal, you are not inside Documents. Secondly, you cannot run the .cpp file as ./trya.cpp. You have to compile the .cpp file first[using some cpp compiler like g++] which will give you an object file [like a.out] that you can run as ./a.out.

answered Aug 21, 2021 at 9:23

0

This problem only occurred when there was space in the name of file. It got resolved as soon as i removed the space in the name of the file or replaced it with underscore.

Chủ Đề