• Najnowsze pytania
  • Bez odpowiedzi
  • Zadaj pytanie
  • Kategorie
  • Tagi
  • Zdobyte punkty
  • Ekipa ninja
  • IRC
  • FAQ
  • Regulamin
  • Książki warte uwagi

Nie mogę skompilować programu z plikiem.h

Object Storage Arubacloud
0 głosów
283 wizyt
pytanie zadane 28 lutego 2021 w C i C++ przez tonn204 Mądrala (7,440 p.)

Witam, chcę podłączyć do projektu bibliotekę do obsługi  wyświetlacza LCD. Kompilator pokazuje, że nie zostały zadeklarowane makra w bibliotece. Do pliku.c próbowałem dodać jeszcze te biblioteki, które podłączone są w pliku.h, ale to nic nie dało. Wcześniej nie miałem takiego problemu z tą biblioteką. Sz

To co wyświetla mi kompilator:

HD44780.c: In function '_LCD_OutNibble':
make[2]: Leaving directory 'D:/AVR Projects/wafefrom_generator.X'
HD44780.c:21: error: 'PORTA' undeclared (first use in this function)
nbproject/Makefile-default.mk:95: recipe for target '.build-conf' failed
HD44780.c:21: error: (Each undeclared identifier is reported only once
make[1]: Leaving directory 'D:/AVR Projects/generator.X'
HD44780.c:21: error: for each function it appears in.)
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
HD44780.c:21: error: 'PA4' undeclared (first use in this function)
HD44780.c:26: error: 'PA5' undeclared (first use in this function)
HD44780.c:31: error: 'PA6' undeclared (first use in this function)
HD44780.c:36: error: 'PA7' undeclared (first use in this function)
HD44780.c: In function '_LCD_Write':
HD44780.c:47: error: 'PORTA' undeclared (first use in this function)
HD44780.c:47: error: 'PA3' undeclared (first use in this function)
HD44780.c: In function 'LCD_WriteCommand':
HD44780.c:62: error: 'PORTA' undeclared (first use in this function)
HD44780.c:62: error: 'PA2' undeclared (first use in this function)
HD44780.c: In function 'LCD_WriteData':
HD44780.c:72: error: 'PORTA' undeclared (first use in this function)
HD44780.c:72: error: 'PA2' undeclared (first use in this function)
HD44780.c: In function 'LCD_Initalize':
HD44780.c:122: error: 'DDRA' undeclared (first use in this function)
HD44780.c:122: error: 'PA4' undeclared (first use in this function)
HD44780.c:123: error: 'PA5' undeclared (first use in this function)
HD44780.c:124: error: 'PA6' undeclared (first use in this function)
HD44780.c:125: error: 'PA7' undeclared (first use in this function)
HD44780.c:126: error: 'PA3' undeclared (first use in this function)
HD44780.c:127: error: 'PA2' undeclared (first use in this function)
HD44780.c:129: error: 'PORTA' undeclared (first use in this function)
make[2]: *** [build/default/production/HD44780.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 112ms)

 

1
komentarz 1 marca 2021 przez tkz Nałogowiec (42,000 p.)
Dla jakiego MCU przeprowadzasz kompilacje? Pokaż makefile, albo pełną linie z komendą, albo cokolwiek czego używasz.
komentarz 1 marca 2021 przez tonn204 Mądrala (7,440 p.)

Mikrokontroler to Atmega328P. Poniżej wklejam kod makefile:

#
#  There exist several targets which are by default empty and which can be 
#  used for execution of your targets. These targets are usually executed 
#  before and after some main targets. They are: 
#
#     .build-pre:              called before 'build' target
#     .build-post:             called after 'build' target
#     .clean-pre:              called before 'clean' target
#     .clean-post:             called after 'clean' target
#     .clobber-pre:            called before 'clobber' target
#     .clobber-post:           called after 'clobber' target
#     .all-pre:                called before 'all' target
#     .all-post:               called after 'all' target
#     .help-pre:               called before 'help' target
#     .help-post:              called after 'help' target
#
#  Targets beginning with '.' are not intended to be called on their own.
#
#  Main targets can be executed directly, and they are:
#  
#     build                    build a specific configuration
#     clean                    remove built files from a configuration
#     clobber                  remove all built files
#     all                      build all configurations
#     help                     print help mesage
#  
#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
#  .help-impl are implemented in nbproject/makefile-impl.mk.
#
#  Available make variables:
#
#     CND_BASEDIR                base directory for relative paths
#     CND_DISTDIR                default top distribution directory (build artifacts)
#     CND_BUILDDIR               default top build directory (object files, ...)
#     CONF                       name of current configuration
#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
#
# NOCDDL


# Environment 
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk

 

komentarz 2 marca 2021 przez tkz Nałogowiec (42,000 p.)

https://hackaday.com/2016/03/15/embed-with-elliot-microcontroller-makefiles/ 

## Chip and project-specific global definitions

MCU = atmega328p

F_CPU = 8000000UL

BAUD = 9600UL

CPPFLAGS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -I.

1 odpowiedź

0 głosów
odpowiedź 2 marca 2021 przez tonn204 Mądrala (7,440 p.)
Problem rozwiązany. Po prostu w pliku.h miałem zadeklarowane porty, które nie są dostępne na Atmedze328p

Podobne pytania

0 głosów
1 odpowiedź 295 wizyt
pytanie zadane 4 marca 2016 w C i C++ przez Mavimix Dyskutant (8,390 p.)
0 głosów
1 odpowiedź 392 wizyt
pytanie zadane 19 lutego 2020 w Mikrokontrolery przez Mavimix Dyskutant (8,390 p.)
0 głosów
1 odpowiedź 632 wizyt

92,567 zapytań

141,420 odpowiedzi

319,615 komentarzy

61,952 pasjonatów

Motyw:

Akcja Pajacyk

Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡

Oto polecana książka warta uwagi.
Pełną listę książek znajdziesz tutaj.

Akademia Sekuraka

Kolejna edycja największej imprezy hakerskiej w Polsce, czyli Mega Sekurak Hacking Party odbędzie się już 20 maja 2024r. Z tej okazji mamy dla Was kod: pasjamshp - jeżeli wpiszecie go w koszyku, to wówczas otrzymacie 40% zniżki na bilet w wersji standard!

Więcej informacji na temat imprezy znajdziecie tutaj. Dziękujemy ekipie Sekuraka za taką fajną zniżkę dla wszystkich Pasjonatów!

Akademia Sekuraka

Niedawno wystartował dodruk tej świetnej, rozchwytywanej książki (około 940 stron). Mamy dla Was kod: pasja (wpiszcie go w koszyku), dzięki któremu otrzymujemy 10% zniżki - dziękujemy zaprzyjaźnionej ekipie Sekuraka za taki bonus dla Pasjonatów! Książka to pierwszy tom z serii o ITsec, który łagodnie wprowadzi w świat bezpieczeństwa IT każdą osobę - warto, polecamy!

...