Topic: No such file or directory «error not input file» Build filed 2 errors (Read 42237 times)
Can you help me ? I can not fix the error.
Logged
Logged
I tried it but it is not fix.
Logged
Logged
I am so sorry.
-------------- Build: Debug in deneme3 (compiler: GNU GCC Compiler)---------------gcc.exe -o binDebugdeneme3.exe objDebugmain.o
gcc.exe: error: objDebugmain.o: No such file or directory
gcc.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))
Logged
Have you modified the project?
Lets try to fix it:
Project->Properties->Build targets->Build target files -> Is main.cpp checked?
Have you tried a new project? Without modification?
Does the path to your project has special characters, like non english or spaces?
Edit:
Have you tried a rebuild: Build->Rebuild?
Please post always a build log if you can
greetings
Logged
Thank you for your help , ı gat it. I fixed the error,
i changed the filename and the problem was solved.
« Last Edit: September 06, 2020, 08:54:56 pm by ERBULUT »
Logged
I have the same problem, how did you fix it? Please help me
Logged
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 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
—
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org
-------------- Build: Debug in tyew (compiler: GNU GCC Compiler)---------------g++.exe -o binDebugtyew.exe objDebugmain.o
g++.exe: error: objDebugmain.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 binDebugfhghgh.exe objDebugmain.o
g++.exe: error: objDebugmain.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
« Last Edit: September 17, 2021, 09:59:03 am by Poruks »
Logged
Logged
Logged
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
1 |
|
28.12.2017, 14:19. Показов 7209. Ответов 14
Привет! Обычно перед тем как спрашивать, я гуглю и всё решается, но в этот раз это не помогло ( Появилась проблема при добавлении класса в проект. То есть как я понимаю, по каким-то причинам компилятор не создаёт файл с расширением .о …….SomeClassmain.cpp -o objDebugmain.o||No such file or directory| ————— Build: Debug in SomeClass (compiler: GNU GCC Compiler)————— mingw32-g++.exe -Wall -fexceptions -g -I»F:…SomeClass» -c «F:…SomeClassmain.cpp» -o objDebugmain.o mingw32-g++.exe: error: SomeClassmain.cpp -o objDebugmain.o: No such file or directory Process terminated with status 1 (0 minute(s), 0 second(s)) Интересно, что некоторое время назад я создавал проект с добавлением класса и всё было нормально
__________________
0 |
73 / 86 / 40 Регистрация: 02.11.2017 Сообщений: 379 |
|
28.12.2017, 15:07 |
2 |
В ошибке он пишет, что не может найти файла. Проверьте пути расположения. Возможно, вы перемещали проект ил еще что-то. Проверьте, что существуют директории obj, Debug.
0 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
28.12.2017, 16:15 [ТС] |
3 |
Спасибо за ответ! Вот отличия от проекта, который у меня несколько недель назад успешно создался — там есть файл объекта, проект компилируется А в новых проектах, он почему-то не может создавать файлы объектов Ну, как я понял, проблема именно в этом Изображения
0 |
73 / 86 / 40 Регистрация: 02.11.2017 Сообщений: 379 |
|
28.12.2017, 16:27 |
4 |
Файл объекта появляется в результате компиляции. Поскольку компиляции не происходит — то и файла, естесственно, нет.
0 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
28.12.2017, 18:55 [ТС] |
5 |
Файл объекта появляется в результате компиляции. Поскольку компиляции не происходит — то и файла, естесственно, нет. Именно так, в этом и проблема! Нужно разобраться почему её не происходит Проект создавал как обычно Вот, как я создаю проект по шагам
0 |
3433 / 2812 / 1249 Регистрация: 29.01.2016 Сообщений: 9,426 |
|
28.12.2017, 19:10 |
6 |
Вот, как я создаю проект по шагам Опиши, как создаёшь тот проект, который НЕ компилируется.
0 |
410 / 145 / 48 Регистрация: 02.06.2016 Сообщений: 331 |
|
28.12.2017, 19:22 |
7 |
Чтобы избежать такого глюка в будущем, классы создавайте через мастер File->New->Class, при этом ничего не трогать в предлагаемых путях. Т.е. C::B внутри проекта создаст паки include и src и там будут храниться классы. А сейчас попробуйте удалить папки obj и bin и перезагрузите C::B.
0 |
techpriest 634 / 213 / 57 Регистрация: 27.02.2014 Сообщений: 1,180 |
|
28.12.2017, 19:22 |
8 |
Что то вы путаетесь в показаниях…. В ошибке диск F. В примере ниже диск С.
0 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
28.12.2017, 21:59 [ТС] |
9 |
Mirmik, я сделал несколько новых проектов в корне диска С, чтобы посмотреть, будет ли работать И интересно, что в корне диска, проекты стали компилироваться, хотя например вчера на версии 13.12 они так же не компилировались. GoshaM, да, так и делаю.. nd2 Опиши, как создаёшь тот проект, который НЕ компилируется. Абсолютно так же Экспериментально выяснил, что теперь, с новой версией C::B, проекты с дополнительными классами компилируются только есть в пути не попадается папка с пробелами. Это у всех так? Или у кого то и с пробелами в названии папки компилируется?
0 |
410 / 145 / 48 Регистрация: 02.06.2016 Сообщений: 331 |
|
29.12.2017, 05:55 |
10 |
Если бы так и делали, то внутри папки с проектом были бы папки include и src, в которых,соответственно лежали бы файлы *.h и *.cpp класса. А у вас класс лежит в корне проекта.
0 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
29.12.2017, 22:21 [ТС] |
11 |
Нет, таких папок никогда не создавалось.. Есть папки bin и obj Добавлено через 16 часов 19 минут В итоге получается так, что если кто сталкивается с такой проблемой, нужно убедиться, что путь к проекту не содержит пробелов и возможно, кириллицу. По крайней мере я нашёл именно такую закономерность Думаю, тему можно закрыть.
0 |
410 / 145 / 48 Регистрация: 02.06.2016 Сообщений: 331 |
|
30.12.2017, 09:51 |
12 |
Не создавалось, потому что меняли настройки при создании класса.
0 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
30.12.2017, 23:01 [ТС] |
13 |
Какая у вас версия C::B? Какой компилятор используете? Вот окно: Миниатюры
0 |
410 / 145 / 48 Регистрация: 02.06.2016 Сообщений: 331 |
|
31.12.2017, 08:36 |
14 |
Header and implementation file shall be in same folder отключите.
1 |
0 / 0 / 0 Регистрация: 28.12.2017 Сообщений: 14 |
|
01.01.2018, 02:46 [ТС] |
15 |
Да, всё верно, теперь всё работает даже если в пути к проекту есть пробелы или рус символы Только эта настройка была уже по умолчанию (ну или я не помню как и зачем её включил..)
0 |
Вопрос:
Вот шаги, которые я выполнил в CodeBlocks IDE:
Create a new project->console->C->Name->debug and release->finish
Поэтому, когда я выбираю main.c
и main.c
его, он должен показывать “Hello World!”, Но я получаю этот странный mingw32-gcc.exe: error: CreateProcess: No such file or directory
ошибка mingw32-gcc.exe: error: CreateProcess: No such file or directory
.
Таким образом я написал и скомпилировал около 20 файлов C, но я не знаю, что недавно произошло с IDE.
Я проверил форум CodeBlocks и погуглил эту проблему, результатов нет
Есть идеи?
Bulid Log:
-------------- Build: Debug in C (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -g -c "C:...Project FilesC CodesCmain.c" -o objDebugmain.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)
Я использовал CodeBlocks 10.02 три дня назад, и он успешно скомпилировал и запустил код. Это показало эту ошибку вчера. Я подумал, что, возможно, файл кода не был включен, поэтому я удалил предыдущий код из проекта и добавил новый файл (я делаю это примерно для 20 программ и всегда получаю результаты); но ошибка все еще существует. Затем я перестроил проект, но все равно получил ошибку. Я удалил ver.10.02 и установил новую версию 12.11 сегодня. Я снова получаю эту странную ошибку.
PS Похоже, у кого-то тоже была эта проблема:
mingw32-g++. exe: ошибка: CreateProcess: нет такого файла или каталога
Лучший ответ:
Получил это окончательно:
В моем случае проблема возникла в результате программы под названием EGCS (Экспериментальная/Расширенная система компилятора GNU). Я установил его как предварительное условие для PSCAD (Power Systems CAD) вместе с FORTRAN Компилятор. Просто удалите его, и все будет хорошо.
(К сожалению, я удалил из-за ошибки. Так что?… я закончил установку новой Win7, но после удаления моего Ubuntu, который снова из-за проблем с загрузкой, возникших в результате удаления GRUB, я снова кончался с fixmbr и fixboot fellas (Но я потерял свой DVD-плеер для ноутбуков!)… В итоге, EGCS рассмеялся меня за 0,5 * МЕСЯЦ…)
Для получения дополнительной информации о таких проблемах посетите здесь (Code:: Blocks Forum)
Ответ №1
Кодовые блоки, кажется, вызывают gcc correct – я не вижу ничего плохого в том, как он вызывается. Сообщение об ошибке, которое вы получаете:
gcc.exe: error: CreateProcess: Нет такого файла или каталога
указывает, что что-то не так с вашей установкой mingw-gcc. Поскольку вы сказали, что это работает ранее, вероятно, это означает, что некоторые файлы, необходимые для работы gcc, либо повреждены, либо переименованы, либо перепутаны, либо удалены случайно.
Фактически, я смог воспроизвести эту точную ошибку, переименовав cc1.exe
. Это компилятор C, который gcc должен скомпилировать исходный файл C. В моей установке для Mingw-4.6.3 это находится под ./libexec/gcc/i686-w64-mingw32/4.6.3
. Ваш может отличаться в зависимости от того, какая версия и вариант mingw вы используете.
Я рекомендую загрузить и переустановить вашу копию gcc вообще, так как исправление этого вручную может быть сложным.
Ответ №2
Ответы здесь не помогли решить мою проблему! Мой друг понял это для меня. Решение было довольно простым и прямым. Возникла проблема, заключавшаяся в том, что компилятор не мог связать себя с MinGW (Minimalist GNU для Windows), который мог быть изменен некоторыми другими файлами make для make файлов, таких как CMake и т.д. Таким образом, решение:
- Откройте Codeblocks и в верхней панели инструментов выберите параметр Settings и под ним выберите параметр компилятора.
- Он откроет окно настройки компилятора. Здесь выберите параметры глобального компилятора (с символом Gear), а в подпараметрах выберите вариант исполняемых файлов Toolchain.
- В этом разделе выберите каталог установки компилятора. Здесь просматриваются файлы для выбора: C:Program Files (x86)CodeblocksMinGWbin
- Теперь выберите опцию “Автоматическое обнаружение” справа.
Он должен решить вашу проблему, и я надеюсь, что вы поняли, в чем проблема! Счастливое программирование!
Ответ №3
Я просто решил эту ошибку. Вероятно, я получил это, когда я случайно переместил файл, который был запущен в C-Free IDE. Все, что вам нужно сделать, – найти файл g++ exe в файлах программы. Просто просмотрите файлы программы конкретной IDE и найдите папку mingW и найдите “g++. Exe”,
внутри него.
Ответ №4
Это обычно происходит, когда компиляторы PATH в Codeblocks не являются допустимыми. В моем случае это указывало на C:/MinGW. Какие кодовые блоки обнаружены с помощью функции автоматического обнаружения.
Чтобы избавиться от этой ошибки, вам нужно изменить путь назад к тому, который присутствует в папке программы Codeblocks.
В моем случае это было – C:Program Files (x86)CodeBlocksMinGW.
Вы можете изменить путь в Codeblocks, выполнив следующие шаги.
Строка меню- > Настройки- > Компилятор- > Исполняемые файлы.
Затем введите соответствующий допустимый путь к каталогу компилятора.
Надеюсь, что это решает вашу проблему.
Ответ №5
У меня все еще была проблема с этой ошибкой. Оказывается, это было там, потому что у меня был MinGW, установленный снаружи перед установкой CodeBlocks.
В этом случае проверьте, не указывает ли ваш путь к каталогу (объясняется, как его изменить) не C:MinGWbin
, а вместо этого C:Program Files (x86)CodeBlocksMinGWbin
, так как это может вызвать появление ошибки.
Ответ №6
После двух дней борьбы я подтвердил решение от кодсаворы и Ананда М.П.
Вся причина в исполняемых файлах Toolchain. Я наконец обнаружил, что это был путь Cygwin!
После того, как я изменил на D:GreenSoftCodeBlocksMinGW, он скомпилируется нормально!
Я думаю, что проблема возникает на этапе установки: кодовые блоки обнаруживают всюду на вашем ПК, чтобы найти существующий gcc, и позволяют вам выбрать один из них как ваш любимый. Он даже забыл, что установщик уже связан с minGW !, и он не показывает, где находится обнаруженный gcc! Так что если вы просто подтвердите один и забудете его, он откажется от прилагаемого minGW.
- Forum
- Beginners
- Error message, again
Error message, again
I just spent a long time trying to figure out a problem, and when i finally figured it out, i had to change the file from a .c to a .cpp, it gave me this new error message
mingw32-g++.exe: error: objDebugUntitled1.o: No such file or directory
|
|
If someone could please help, thanks!
what compiler are you using? (not IDE)
GNU GCC Compiler.
Your project setting are messed up because you changed the file. My advice if that is all that your program is just start over from scratch and make a new project.
I did that, and now i have this error message,
`main’
objDebugmain.o:C:/Users/David/Documents/C++/Variables/main.cpp:6: first defined here
collect2.exe: error: ld returned 1 exit status
Im confoused!
thats a linker error!
(i have that problem with something else right now in SDL :P)
you havnt installed your IDE properly, have you just installed it? some file is missing or summink.
Last edited on
What is that?
you a brand new coder? even though this took me forever to suss out and they never write enough about it,
the compiler knows how to crunch keywords into machine code, and it needs to know how to do that by knowing where all the source code is to do that, where it looks is the liker options, i didnt have to worry about this right away, unfortunatley you do, dont be put off though, this bit is hard and you dont normaly have to deal with it straight away
my problem right now is that im trying to add libraries and my linker doesnt know where they are, so it doesnt know what the keywords i popped in actually mean! so i get the same error you are!
this is hard to explain, we need one of the better coders to help you because this is my weakness
Last edited on
Go into C:/Users/David/Documents/C++/Variables/ on your computer and list every file you see there for me please.
I never actually found anything on linkers and linker settings, if you find a good recourse please let me know
bin
obj
main,cpp
untitled1.cpp
variables.cpp
variables.depend
variables.layout
Those are all of the files
And yes, this is third day, spending the second day trying to figure this out. And i also just installed Code: :Blocks.
you get days like that, I remember there are tutorials on using for the first time, making sure you use the right compiler settings , are you using version 12.11??
Last edited on
Just delete all them files so the Variables folder is nice and clean then try creating a new project in that folder.
If that doesn’t work I would do a full reinstall of your compiler/IDE. It is most likely not a linker problem since the compiler should have set up all the linker setting for you automatically (Though it can mess up sometimes which is why a reinstall might help) and you haven’t downloaded any libraries on your own i don’t think.
Last edited on
yup version 12.11.
dude go to compiler go to settings go to toolchain executables, in the field C++ compiler in the program files tab do you have ming32-g++.exe?
what do you have ticked in compiler flags??
Last edited on
Devon his compiler is working….. He is getting error messages where do you think they come from? ;p
Last edited on
I have this one mingw32-g++.exe, i dont what the flags are though
lol oh yeah, re install it, its being weird.
Topic archived. No new replies allowed.
Introduction
In this intermittent series, I’ll be looking at the most common error messages your C++ compiler (and linker) can produce, explaining exactly what they mean, and showing how they can be fixed (or, better still avoided). The article will specifically talk about the errors produced by the GCC command line compiler, but I’ll occasionally provide some coverage of Microsoft C++ as well. The articles are aimed at beginner to intermediate C++ programmers, and will mostly not be OS-specific.
Error Messages 101
Compiler error messages from the GCC g++ compiler generally look like something this:
main.cpp: In function 'int main()': main.cpp:4:12: error: 'bar' was not declared in this scope
which was produced by this code:
int main() { int foo = bar; }
The first line of the error says which function the following error(s) is in. The error message itself comes in four main parts; the file the error occurs in, the line number and character offset at which the compiler thinks the error occurs, the fact that it is an error, and not a warning, and the text of the message.
As well as error, the compiler can also produce warnings. These are usually about constructs that, while not being actually illegal in C++, are considered dubious, or constructs that the compiler has extensions to cover. In almost all cases, you don’t want to use such constructs, and you should treat warnings as errors; in other words, your code should always compile with zero warnings. You should also increase the level of warnings from the compiler’s default, which is usually too low. With g++, you should use at least the -Wall and -Wextra compiler options to do this:
g++ -Wall -Wextra myfile.cpp
No such file or directory
The error I’m looking at today most commonly occurs when you are including a header file using the preprocessor #include directive. For example, suppose you have the following code in a file called myfile.cpp:
#include "myheader.h"
and you get the following error message:
myfile.cpp:1:22: fatal error: myheader.h: No such file or directory compilation terminated.
What could be causing it? Well, the basic cause is that the compiler cannot find a file called myheader.h in the directories it searches when processing the #include directive. This could be so for a number of reasons.
The simplest reason is that you want the compiler to look for myheader.h in the same directory as the myfile.cpp source file, but it can’t find it. this may be because you simply haven’t created the header file yet, but the more common reason is that you either misspelled the header file name in the #include directive, or that you made a mistake in naming the header file when you created it with your editor. Look very closely at the names in both the C++ source and in your source code directory listing. You may be tempted to think «I know that file is there!», but if the compiler says it isn’t there, then it isn’t, no matter how sure you are that it is.
This problem is somewhat greater on Unix-like system, such as Linux, as there file names are character case sensitive, so Myheader.h, MyHeader.h, myheader.h and so on would all name different files, and if you get the case wrong, the compiler will not look for something «similar». For this reason, a very good rule of thumb is:
Never use mixed case when naming C++ source and header files. Use only alphanumeric characters and the underscore when naming C+++ files. Never include spaces or other special characters in file names.
Apart from avoiding file not found errors, this will also make life much easier if you are porting your code to other operating systems which may or may not respect character case.
The wrong directory?
Another situation where you may get this error message is if you have split your header files up from your C++ source files into separate directories. This is generally good practice, but can cause problems. Suppose your C++ project is rooted at C:/myprojects/aproject, and that in the aproject directory you have two sub-directorys called src (for the .cpp files) and inc (for the header files), and you put myfile.cpp in the src directory, and myheader.h in the inc directory, so that you have this setup:
myprojects aproject inc myheader.h src myfile.cpp
Now if you compile the source myfile.cpp from the src directory, you will get the «No such file or directory» error message. The C++ compiler knows nothing about the directory structures of your project, and won’t look in the inc directory for the header. You need to tell it to look there somehow.
One thing some people try when faced with this problem is to re-write myfile.cpp so it looks like this:
#include "c:/myprojects/aproject/inc/myheader.h"
or the slightly more sophisticated:
#include "../inc/myheader.h"
Both of these are a bad idea, as they tie your C++ code to the project’s directory structure and/or location, both of which you will probably want to change at some point in the future. If the directory structure does change, you will have to edit all your #include directories.The better way to deal with this problem is to tell the compiler directly where to look for header files. You can do that with the compiler’s -I option, which tells the compiler to look in the specified directory, as well as the ones it normally searches:
g++ -Ic:/myprojects/aproject/inc myfile.cpp
Now the original #include directive:
#include "myheader.h"
will work, and if your directory structure changes you need only modify the compiler command line. Of course, writing such command lines is error prone, and you should put such stuff in a makefile, the use of which is unfortunately outside the scope of this article.
Problems with libraries
Somewhat similar issues to those described above can occur when you want to use a third-party library. Suppose you want to use the excellent random number generating facilities of the Boost library. If you are copying example code, you may well end up with something like this in your C++ source file:
#include "boost/random.hpp"
This will in all probability lead to yet another «No such file or directory» message, as once again the compiler does not know where «boost/random.hpp» is supposed to be. In fact, it is one of the subdirectories of the Boost installation, and on my system I can get the #include directive to work using this command line:
g++ -Ic:/prog/boost1461 myfile.cpp
where /prog/boost1461 is the root directory for my specific Boost library installation.
Can’t find C++ Standard Library files?
One last problem that beginners run into is the inability of the compiler to find header files that are part of the C++ Standard Library. One particular favourite is this one:
#include <iostream.h>
where you are learning C++ from a very, very old book. Modern C++ implementations have not contained a file called iostream.h for a very long time indeed, and your compiler is never going to find it. You need to use the correct, standard names for such headers (and to get a better book!):
#include <iostream>
If this still fails, then there is almost certainly something very wrong with your GCC installation. The GCC compiler looks for Standard Library files in a subdirectory of its installation, and locates that directory relative to the directory containing the compiler executable, so if the Standard Library headers are available, the compiler should always find them.
Conclusion
This article looked at the «No such file or directory» message of the GCC C++ compiler. If you get this message you should:
- Remember that the compiler is always right in situations like this.
- Look very closely at the file name to make sure it is correct.
- Avoid naming file using mixed-case or special characters.
- Use the -I compiler option to tell the compiler where to look for files.
- Make sure that GCC is correctly installed on your system.