I am currently failing to write a good makefile and don’t know the reason why.. -.-
This is my main.c:
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("MEEEEEP");
return (0);
}
This is my makefile:
# make SYSTEM= OS= ENVIRONMENT=
# Binaries to use
ifeq ($(ENVIRONMENT),MINGW)
CXX = i686-pc-mingw32-g++
else
CXX = g++
endif
REMOVE = rm -vf
RC = windres
EXE = .exe
#############################################################
# Info
ifeq ($(CXX),g++)
INFO_CXX = g++ -dumpversion; g++ -dumpmachine
endif
#############################################################
# Flags
DEBUG = -DDEBUG -g
OPTIMIZATION = -O2 #-Winline -finline-functions
CFLAGS = -Wall -Wextra -W -static $(DEBUG) $(OPTIMIZATION) -D$(SYSTEM) -D$(OS) -D$(ENVIRONMENT) $(PRGFLAGS)
ifeq ($(SYSTEM),I686)
CFLAGS += -m32
ifeq ($(OS),WIN32)
CFLAGS += -D_WIN32
endif
ifeq ($(ENVIRONMENT),MINGW)
CFLAGS += -fexceptions
endif
endif
LFLAGS =
#############################################################
# Files
CFILES = main.c
OBJS = ${CFILES:.c=.o}
#############################################################
# Include
INCLUDES = -I.
#############################################################
# Library
LIBRARIES =
#############################################################
# Targets
.PHONY: all
all:
@echo == Standard build: make SYSTEM=I686 OS=WIN32 ENVIRONMENT=MINGW
@echo
@echo
make SYSTEM=I686 OS=WIN32 ENVIRONMENT=MINGW gyro
#############################################################
# Implicit rules and filename extensions...
.SUFFIXES: .h .o .c
.c.o: %.h
@echo Compiling $< for $(SYSTEM) $(OS) $(ENVIRONMENT) ...
@echo MEEP
$(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@
@echo MEEP2
#############################################################
# Target rules
gyro: $(OBJS)
@echo Building software for $(SYSTEM) ...
@echo
$(CXX) $(CFLAGS) $(LFLAGS) -o $@$(EXE) $(OBJS) $(LIBRARIES)
#############################################################
# Clean
.PHONY: clean
clean:
$(REMOVE) $(OBJS)
#############################################################
# Info
.PHONY: info
info:
@echo
@echo Information about C++ Compiler/Linker:
@echo
$(INFO_CXX)
When i type in make gyro,
i receive the output:
Compiling main.c for Windows_NT ...
MEEP
g++ -Wall -Wextra -W -static -DDEBUG -g -O2 -D -DWindows_NT -D -I. -c main.c -o main.o
makeNew.mak:83: recipe for target `main.o' failed
make: *** [main.o] Error 1
But Line number 83 is behind .c.o: %.h. And i don’t understand why.
Does anyone have a solution for me?
|
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||
|
1 |
||||
|
05.06.2018, 16:10. Показов 19272. Ответов 16 Метки нет (Все метки)
Помогите разобраться где косяк
м.б. удалить этот » makefile» ? Добавлено через 5 часов 25 минут
__________________
0 |
|
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
|
07.06.2018, 14:20 [ТС] |
2 |
|
аууу!!!
0 |
|
1280 / 1186 / 175 Регистрация: 02.12.2013 Сообщений: 4,884 |
|
|
07.06.2018, 14:49 |
3 |
|
Atmel Studio 7 автоматически генирит makefile и лезть в него не понимая для чего он нужен и что в нем написано совсем не нужно. Пере создайте проект и запустите отладку в симуляторе, будут ошибки компилятора выкладывайте здесь.
1 |
|
1961 / 1275 / 130 Регистрация: 04.01.2010 Сообщений: 4,607 |
|
|
08.06.2018, 14:15 |
5 |
|
gcc (это компилятор такой) выкладывает стек ошибок при выполнении задачи makefile. Вот и получается, ошибки «посыпались», одна, рождая другую. Исправьте ошибки в исходниках, и возможно все ваши остальные сложности отпадут за ненадобностью.
1 |
|
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
|
09.06.2018, 14:10 [ТС] |
6 |
|
спасибо, я это уже понял, читаю доки на С++ и ищу где накосячил
0 |
|
1280 / 1186 / 175 Регистрация: 02.12.2013 Сообщений: 4,884 |
|
|
09.06.2018, 14:34 |
7 |
|
Для AVR лучше писать на чистом СИ
0 |
|
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
|
13.06.2018, 09:26 [ТС] |
8 |
|
в Atmel Studio 7 вроде как С++ используется, так почему бы не воспользоваться его ++ми
0 |
|
1280 / 1186 / 175 Регистрация: 02.12.2013 Сообщений: 4,884 |
|
|
13.06.2018, 10:22 |
9 |
|
Потому что не зная тонкостей работы компилятора плюсов, Вы можете значительно увеличить размер программы и снижения быстродействия. На ПИ СИ это не очень страшно, а вот в AVR памяти мало
0 |
|
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
|
13.06.2018, 11:47 [ТС] |
10 |
|
я в курсе и взял МК с запасом тини1616, но сейчас важнее запустить проект, а оптимизацией можно будет заняться и после, «если что»
0 |
|
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
|
18.06.2018, 11:46 [ТС] |
11 |
|
в другой моей теме написал «регулярно запинаюсь из-за разных подходов(в примерах) в программировании на С / С++ и для разных сред и за разные годы издания фирменной документации»
0 |
|
296 / 227 / 102 Регистрация: 11.08.2016 Сообщений: 780 |
|
|
24.06.2018, 14:37 |
12 |
|
nik-el, лог ошибок в студию
0 |
|
0 / 0 / 0 Регистрация: 13.04.2017 Сообщений: 41 |
|
|
06.12.2019, 01:05 |
13 |
|
У меня проблема один к одному, как у автора этой темы — nik-el. Хотя перечитал и выполнил все советы — проблему не решил. Коротко повторюсь. В новый проект (С/С++) Atmel Studio 7 загрузил пример на простом С отсюда. Уменьшил количество ошибок до 2-х: Что делать дальше не знаю. Где копать? Заранее благодарю за помощь. Миниатюры
0 |
|
576 / 340 / 66 Регистрация: 21.09.2008 Сообщений: 1,183 |
|
|
07.12.2019, 20:46 |
14 |
|
Реализация функции uart_init() где?
0 |
|
0 / 0 / 0 Регистрация: 13.04.2017 Сообщений: 41 |
|
|
08.12.2019, 11:10 |
15 |
|
Реализация функции uart_init() где? В библиотеке uart.h: void uart_init(void);
0 |
|
Модератор
8756 / 6546 / 887 Регистрация: 14.02.2011 Сообщений: 22,962 |
|
|
08.12.2019, 14:14 |
16 |
|
В библиотеке uart.h: void uart_init(void); это не реализация, это объявление
0 |
|
0 / 0 / 0 Регистрация: 13.04.2017 Сообщений: 41 |
|
|
16.12.2019, 12:56 |
17 |
|
Решение проблемы есть тут.
0 |
Форум РадиоКот • Просмотр темы — Ошибка recipe for target ‘main.o’ failed Atmel Studio7
Сообщения без ответов | Активные темы
| ПРЯМО СЕЙЧАС: |
| Автор | Сообщение |
|---|---|
|
|
Заголовок сообщения: Ошибка recipe for target ‘main.o’ failed Atmel Studio7
|
|
Нашел транзистор. Понюхал.
Карма: -1 Рейтинг сообщения: 0
|
Не собирается проект. Ошибку recipe for target ‘main.o’ failed. Makefile выглядит так: Если кто-то может разъяснить, в чем может быть причина — буду очень благодарен. |
| Вернуться наверх |
Профиль
|
| Реклама | |
|
|
|
|
Land |
Заголовок сообщения: Re: Ошибка recipe for target ‘main.o’ failed Atmel Studio7
|
|
Нашел транзистор. Понюхал.
Карма: -1 Рейтинг сообщения: 0
|
Собственно проблема оказалась в подключении #include. Тема закрыта. |
| Вернуться наверх | |
| Реклама | |
|
|
|
Кто сейчас на форуме |
|
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 10 |
| Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете добавлять вложения |

I got this error while trying to compile blynk-library/linux
raspberrypi2$ git clone https://github.com/blynkkk/blynk-library.git
Cloning into 'blynk-library'...
remote: Counting objects: 2832, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 2832 (delta 0), reused 0 (delta 0), pack-reused 2828
Receiving objects: 100% (2832/2832), 494.34 KiB, done.
Resolving deltas: 100% (1674/1674), done.
raspberrypi2$ cd blynk-library/linux/
raspberrypi2$ make clean all target=raspberry
rm main.o BlynkDebug.o ../utility/BlynkHandlers.o blynk
rm: cannot remove `main.o': No such file or directory
rm: cannot remove `BlynkDebug.o': No such file or directory
rm: cannot remove `../utility/BlynkHandlers.o': No such file or directory
rm: cannot remove `blynk': No such file or directory
Makefile:62: recipe for target 'clean' failed
make: [clean] Error 1 (ignored)
g++ -I ../ -I ./ -DLINUX -c -O3 -w -DRASPBERRY main.cpp -o main.o
In file included from ./BlynkSocket.h:25:0,
from main.cpp:17:
../Blynk/BlynkProtocol.h: In member function ‘bool BlynkProtocol<Transp>::connect(uint32_t)’:
../Blynk/BlynkProtocol.h:55:13: error: there are no arguments to ‘yield’ that depend on a template parameter, so a declaration of ‘yield’ must be available [-fpermissive]
../Blynk/BlynkProtocol.h:55:13: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Makefile:68: recipe for target 'main.o' failed
make: *** [main.o] Error 1
raspberrypi2$
I fixed this with editing blynk-library/linux/Makefile
raspberrypi2$ diff blynk-library/linux/Makefile-ORIGINAL blynk-library/linux/Makefile-EDITED
48c48
< CFLAGS += -DRASPBERRY
---
> CFLAGS += -DRASPBERRY -fpermissive
Explanation about this flag can be found here
http://stackoverflow.com/questions/8843818/what-does-the-fpermissive-flag-do
The compilation process is now OK
raspberrypi2$ make clean all target=raspberry
rm main.o BlynkDebug.o ../utility/BlynkHandlers.o blynk
rm: cannot remove `main.o': No such file or directory
rm: cannot remove `BlynkDebug.o': No such file or directory
rm: cannot remove `../utility/BlynkHandlers.o': No such file or directory
rm: cannot remove `blynk': No such file or directory
Makefile:62: recipe for target 'clean' failed
make: [clean] Error 1 (ignored)
g++ -I ../ -I ./ -DLINUX -c -O3 -w -DRASPBERRY -fpermissive main.cpp -o main.o
g++ -I ../ -I ./ -DLINUX -c -O3 -w -DRASPBERRY -fpermissive BlynkDebug.cpp -o BlynkDebug.o
g++ -I ../ -I ./ -DLINUX -c -O3 -w -DRASPBERRY -fpermissive ../utility/BlynkHandlers.cpp -o ../utility/BlynkHandlers.o
g++ main.o BlynkDebug.o ../utility/BlynkHandlers.o -lrt -lpthread -s -lwiringPi -o blynk
raspberrypi2$
Here is a code I wrote
#include <stdio.h>
main()
{
printf("Hello World");
}
yeah fully basic
and this is makefile.
# Project: Project2
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = Project2.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
How can I fix this problem?
Atmel Studio 7.
Здравствуйте. Занимаюсь в свободное время небольшим проектом. Пару дней был перерыв, всё работало. Сегодня делаю ребилд, вот Output:
------ Rebuild All started: Project: RF, Configuration: Debug AVR ------
Build started.
Project "RF.cproj" (Clean target(s)):
Target "Clean" in file "D:CircuitsAtmelStudio7.0VsCompiler.targets" from project "D:CircuitsAvrProjectsRadioNannyRFRF.cproj" (entry point):
Task "RunCompilerTask"
Shell Utils Path D:CircuitsAtmelStudio7.0shellUtils
D:CircuitsAtmelStudio7.0shellUtilsmake.exe clean
rm -rf library.o
rm -rf library.d
rm -rf "libRF.elf" "libRF.a" "libRF.hex" "libRF.lss" "libRF.eep" "libRF.map" "libRF.srec" "libRF.usersignatures"
Done executing task "RunCompilerTask".
Done building target "Clean" in project "RF.cproj".
Done building project "RF.cproj".
Build succeeded.
------ Rebuild All started: Project: RF, Configuration: Debug AVR ------
Build started.
Project "RF.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "D:CircuitsAtmelStudio7.0VsCompiler.targets" from project "D:CircuitsAvrProjectsRadioNannyRFRF.cproj" (target "Build" depends on it):
Task "RunCompilerTask"
Shell Utils Path D:CircuitsAtmelStudio7.0shellUtils
D:CircuitsAtmelStudio7.0shellUtilsmake.exe all --jobs 2 --output-sync
D:CircuitsAvrProjectsRadioNannyRFReleaseMakefile(79,1): error: recipe for target 'library.o' failed
make: *** [library.o] Error 1
Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "RF.cproj" -- FAILED.
Done building project "RF.cproj" -- FAILED.
Build FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
В ошибках:
Severity Code Description Project File Line
Error recipe for target 'library.o' failed RF D:CircuitsAvrProjectsRadioNannyRFReleaseMakefile 79
Что находится в Makefile строка 78-82:
78: ./%.o: .././%.c
79: @echo Building file: $<
80: @echo Invoking: AVR/GNU C Compiler : 5.4.0
81: $(QUOTE)D:CircuitsAtmelStudio7.0toolchainavr8avr8-gnu-toolchainbinavr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DNDEBUG -I"D:CircuitsAtmelStudio7.0PacksatmelATtiny_DFP1.2.118include" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=attiny13 -B "D:CircuitsAtmelStudio7.0PacksatmelATtiny_DFP1.2.118gccdevattiny13" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
82: @echo Finished building: $<
Перестало билдиться именно при ребилде. Если откатить изменения, и сделать просто билд — всё работает.
Запускаю студию от администратора, т.е. с правами проблем нет. Да и по логике, если хватает прав удалить при clean файлы, то должно хватать и на создание.
Вообще, мне не совсем понятна фраза recipe for target ‘library.o’ failed.
Изменено 8 апреля, 2017 пользователем A1essandro
В настоящее время я не могу написать хороший make-файл и не знаю, почему.. -.-
Это мой main.c:
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("MEEEEEP");
return (0);
}
Это мой make-файл:
# make SYSTEM= OS= ENVIRONMENT=
# Binaries to use
ifeq ($(ENVIRONMENT),MINGW)
CXX = i686-pc-mingw32-g++
else
CXX = g++
endif
REMOVE = rm -vf
RC = windres
EXE = .exe
#############################################################
# Info
ifeq ($(CXX),g++)
INFO_CXX = g++ -dumpversion; g++ -dumpmachine
endif
#############################################################
# Flags
DEBUG = -DDEBUG -g
OPTIMIZATION = -O2 #-Winline -finline-functions
CFLAGS = -Wall -Wextra -W -static $(DEBUG) $(OPTIMIZATION) -D$(SYSTEM) -D$(OS) -D$(ENVIRONMENT) $(PRGFLAGS)
ifeq ($(SYSTEM),I686)
CFLAGS += -m32
ifeq ($(OS),WIN32)
CFLAGS += -D_WIN32
endif
ifeq ($(ENVIRONMENT),MINGW)
CFLAGS += -fexceptions
endif
endif
LFLAGS =
#############################################################
# Files
CFILES = main.c
OBJS = ${CFILES:.c=.o}
#############################################################
# Include
INCLUDES = -I.
#############################################################
# Library
LIBRARIES =
#############################################################
# Targets
.PHONY: all
all:
@echo == Standard build: make SYSTEM=I686 OS=WIN32 ENVIRONMENT=MINGW
@echo
@echo
make SYSTEM=I686 OS=WIN32 ENVIRONMENT=MINGW gyro
#############################################################
# Implicit rules and filename extensions...
.SUFFIXES: .h .o .c
.c.o: %.h
@echo Compiling $< for $(SYSTEM) $(OS) $(ENVIRONMENT) ...
@echo MEEP
$(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@
@echo MEEP2
#############################################################
# Target rules
gyro: $(OBJS)
@echo Building software for $(SYSTEM) ...
@echo
$(CXX) $(CFLAGS) $(LFLAGS) -o $@$(EXE) $(OBJS) $(LIBRARIES)
#############################################################
# Clean
.PHONY: clean
clean:
$(REMOVE) $(OBJS)
#############################################################
# Info
.PHONY: info
info:
@echo
@echo Information about C++ Compiler/Linker:
@echo
$(INFO_CXX)
Когда я набираю make gyro, я получаю вывод:
Compiling main.c for Windows_NT ...
MEEP
g++ -Wall -Wextra -W -static -DDEBUG -g -O2 -D -DWindows_NT -D -I. -c main.c -o main.o
makeNew.mak:83: recipe for target `main.o' failed
make: *** [main.o] Error 1
Но строка номер 83 находится позади .co: %.h. И я не понимаю, почему. У кого-нибудь есть решение для меня?
during compilation of a program its showing error that «line 28»,, G:aaMakefile.win
» recipe for target ‘main.o’ failed»
please help me how to debug it..
Jul 25 ’15
#1
Where did you get the makefile?
Jul 25 ’15
#2
its installed in that DEV C++ software
Jul 25 ’15
#3
The makefile is generated based on your project code. Without seeing your code for main(), I can’t say for sure but you may not have compiled correctly.
Generating an object file ( a .o) can fail if your code has errors.
Are there any other errors before this one?
Jul 25 ’15
#4
this is the makefile that is generated…
# Project: Project2
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L»C:/Program Files (x86)/Dev-Cpp/MinGW64/lib» -L»C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib» -static-libgcc -pg
INCS = -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/include» -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include» -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include»
CXXINCS = -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/include» -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include» -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include» -I»C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++»
BIN = Project2.exe
CXXFLAGS = $(CXXINCS) -ansi -fno-asm -traditional-cpp -pg
CFLAGS = $(INCS) -ansi -fno-asm -traditional-cpp -pg
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
Jul 26 ’15
#5
this line showing error…
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
Jul 26 ’15
#6
All this tells me is that the error is in main.c. Generated makefiles like this one don’t fail because of errors in the makefile.
That is, errors in your code are causing this. This also means that you are getting more errors than the one you reported.
What does your main.c look like?
Jul 26 ’15
#7
this is my main function
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system(«pause») or input loop */
int main(int argc, char *argv[])
{
return 0;
}
Jul 26 ’15
#8
There are no errors in the code you posted. Is this the exact code you were compiling?
Jul 26 ’15
#9
yeah…while compiling the same program its showing that error…
Jul 27 ’15
#10
Maybe gcc.exe is not accessible with your current PATH.
try typing the offending command at the command prompt:
gcc.exe -c main.c -o main.o
This can’t succeed because it doesn’t include the CFLAGS, but the nature of the failure will tell you if gcc is running. That command line should succeed if you temporarily comment out the #includes in main.c.
Jul 27 ’15
#11
Maybe gcc.exe is not accessible with your current PATH.
try typing the offending command at the command prompt:
gcc.exe -c main.c -o main.o
This can’t succeed because it doesn’t include the CFLAGS, but the nature of the failure will tell you if gcc is running. That command line should succeed if you temporarily comment out the #includes in main.c.
Another possibility is that the long list of include paths makes the expanded command line too long for your shell.
Jul 27 ’15
#12
Sign in to post your reply or Sign up for a free account.



