Diskuze: Chyba v deklaraci funkce
V předchozím kvízu, Online test znalostí C++, jsme si ověřili nabyté zkušenosti z kurzu.


Libor Šimo (libcosenior):15.2.2015 12:08
"unknown type name 'prog_char'"
Podľa všetkého nie je v projekte definovaný tento typ.
Tak to mi je jasné ale jelikož nejsem "vychovám v jazyce C " tak nevím co s tím, ten projekt je tady http://tuxgraphics.org/…server.shtml díky
Libor Šimo (libcosenior):15.2.2015 12:26
Myslel som si, že je to niečo také, ale toto je mimo moje znalosti, aj keď sa s C zaoberám dosť.
David Novák:15.2.2015 12:59
nechybí ti tam naincludovaní některého souboru?
a jak to překládáš? pokud je to projekt o více souborech, je potřeba
každý postupně přeložit a až pak je slinkovat dohromady do spustitelného
souboru..
David Novák:15.2.2015 13:31
A co s tím jako?
Se screenshotem toho nikdo moc neudělá.. Navíc ta chyba je někde úplně
jinde.. Musíš najít, kde se ten typ definuje.. (projdi si ty soubory) a pokud
nikde, očividně ti chybí nějaká knihovna nebo soubor..
Tady jsem něco našel http://www.elektronikforumet.com/…iewtopic.php?… http://tuxgraphics.org/…g_char.shtml jak to mám upravit? díky
David.Landa:16.2.2015 13:49
Tady je každá rada marná -- chybí ti hlavičkový soubor, kde se definuje typ. Pokud se nevyznáš v projektu, není ti jak poradit. Zkus využít funkce hledání symbolu (deklarace) v projektu -- pokud to editor nabizí.
Podle mě jsou tam všechny hlavičkové soubory nebo lépe v jakém hlavičkovém souboru to obyčejně bývá ? výše zmíneném odkazu na fóru je popsán že je to zastaralý typ a je tam ukázka jak to vyřešit a protože jak už jsem uváděl nejsem v tomto jazyku C jak to napsat odborník tak se obracím tady díky
Martin Dráb:16.2.2015 21:10
Je součástí toho projektu Makefile? Jestli se jedná o nějaký projekt pro Arduino/AVR mikrokontroler, tak se zdá, že chyba nebude v neuvedeném hlavičkovém souboru, ale v použití nového kompilátoru.
Typ prog_char * asi znamená, že se jedná o řetězec uložený v programové paměti. Podle tohoto linku (který tu už asi byl):
http://tuxgraphics.org/electronics/201207/prog_char.shtml
novější překladače k zajištění stejného chování užívají "direktivu" PROGMEM. Ale, je možné je donutit ke starému chování pomocí jistých příznaků. Pokud tedy je někde součástí projektu Makefile, tak ho někam uploadni a neměl by být problém to vyřešit (podle linku stačí přidat jen něco do definice proměnné CFLAGS).
Jestli se jedná o větší projekt, tak ho asi bude třeba trochu projít, to je pravda.
P.S.
U mikrokontrolerů se paměť pro uložení kódu (programu) a dat rozlišuje,
neb to není jedno a to samé (tzv. harwardská architektura).
David.Landa:16.2.2015 21:18
Chyba nebude v neuvedeném hlavičkovém souboru, ale přímo v hlavičkovém souboru -- prostě tam ten typ chybí a je nahrazen jiným -- Avr-libc has removed in version 1.8 the datatype prog_char. Tohle přeci zjistí autor dotazu po prvním dotazu do Google a radím mu začít s lehčími příklady, ne nutně pro mikrokontrolery.
Vítězslav Škrabal:17.2.2015 13:51
Je součástí toho projektu Makefile? ano je ale bohužel nevím jak se s
tým pracuje tady je ten projekt
ke stáhnutí http://tuxgraphics.org/…-2.17.tar.gz budu neskonale
vděčný za pomoc díky
David Novák:17.2.2015 13:56
jak říká David.Landa.. začni s něčím jednodušíím, tohle je
docela rozsáhlý projekt.. A ty se to potřebuješ naučit sám - nikdo za tebe
tvé problémy řešit nebude, páč jich mají většinou všichni dost svých
vlastních
Ani když moc poprosím já nemám jinou možnost protože mám DMO a jsem
přes 10 let doma a nikde se nedostanu díky
Tomáš Maňhal:17.2.2015 15:29
Jak jinou možnost?...pro naučení C přece nepotřebuješ nikam chodit, jezdit nebo létat. Pokud jsi schopný někde stáhnout hotový projekt, dělat screenshoty, přispívat do fór a podobně, tak jsi jistě schopný sehnat na internetu materiály, navštěvovat odborné diskuze, klást dotazy a společně s dalšími programátory v branži zlepšovat své schopnosti.
DMO je jistě nezáviděníhodná životní situace (mimochodem, měl jsem
rakovinu, takže o špatných životních situacích něco vím), ale není to
prostředek pro výmluvu, ale prostředek pro neustálou touhu dokázat si, že
na to máš a že to dokážeš. Nezáleží totiž na tom, kdo čím trpí, ale
jak se k tomu postaví. Přeju hodně štěstí při samostudiu Samozřejmě piš nám sem dále
jaké máš případné potíže při programování. Je tu spousta lidí,
kteří rádi poradí, ale nečekej, že za Tebe někdo oddře všechno. Máme i
vlastní životy
Projev snahu
Já jsem se špatně vyjádřil jistě na internetu se dá sehnat skoro vše
ale jde o to abych netrávil u PC tolik času kolik trávím protože to jak na
sobě pociťuji spíše zhoršuje můj zdravotní stav a za druhé nevím jakou
knihu si mám pořídit nehledě k tomu že u nás kde si kupuji odbornou
literaturu bych si mohl s tolika peněz co jsem tam dal vystavit památník
David.Landa:17.2.2015 16:36
Za mne bych chtěl ještě podotknout -- nemám rád jízlivost a moje rada skutečně je mířena jinam. Pokud mám problém, je dobré se nestydět zeptat. Často stačí přehlédnout drobnost a i zkušený se trápí. Ale jakou máš motivaci pro kompilaci cizího projektu? Vytvoř si něco, co od začátku buduješ a víš o každém kroku vývoje -- potom se budeš učit postupně ze svých chyb -- ne z cizích -- navíc jde o chyby verzí knihovek, se kterými to chceš slinkovat.
Úkol: Implementuj základní řadící algoritmy -- SelectSort a InsertSort, plus třeba BubbleSort. Vytvoř si hlavičkový soubor s deklaracemi a jednoduchý Makefile. Nauč se kompilovat z příkazové řádky .)
Při problému neváhej napsat dotaz!
Na to si vůbec netroufám si udělat vlastní projekt který pracuje s LAN modulem který jde stáhnout internetu problém je v tom že je to děláno ve staré verzi avrtoolchainu a já mám novější.Upravil jsem makefile podle tohoto návodu http://tuxgraphics.org/…g_char.shtml ale nechápu co s tím dále udělat
Change this line:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
To:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -D__PROG_TYPES_COMPAT__
díky za trpělivost
David Novák:17.2.2015 18:20
Nikdo neříká, že máš hned dělat projekt, který pracuje s LAN modulem..
začni s něčím jednodušším.. a postupně už nebudeš mít problém ani
se složitějšími věcmi..
když tomu věnuješ dost času, můžeš si třeba napsat i vlastní modul pro
práci s LAN
Tak jsem to přeložil takto takto jste to mysleli? pár souboru *.hex v adresáři přibylo
e:\atmel\eth_rem_dev_tcp-2.17>make
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c test0.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -o test0.out -Wl,-Map,test0.map test0.o
avr-objcopy -R .eeprom -O ihex test0.out test0.hex
avr-size test0.out
text data bss dec hex filename
210 0 0 210 d2 test0.out
Expl.: data=initialized data, bss=uninitialized data, text=code
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c test1.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c enc28j60.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c ip_arp_udp_tcp.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -o test1.out -Wl,-Map,test1.map test1.o enc28j60.o ip_arp_udp_tcp.o
avr-objcopy -R .eeprom -O ihex test1.out test1.hex
avr-size test1.out
text data bss dec hex filename
3226 12 268 3506 db2 test1.out
Expl.: data=initialized data, bss=uninitialized data, text=code
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c test2.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -o test2.out -Wl,-Map,test2.map test2.o enc28j60.o ip_arp_udp_tcp.o
avr-objcopy -R .eeprom -O ihex test2.out test2.hex
avr-size test2.out
text data bss dec hex filename
3378 24 468 3870 f1e test2.out
Expl.: data=initialized data, bss=uninitialized data, text=code
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c test_readSiliconRev.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -o test_readSiliconRev.out -Wl,-Map,test_readSiliconRev.map test_readSiliconRev.o
enc28j60.o ip_arp_udp_tcp.o
avr-objcopy -R .eeprom -O ihex test_readSiliconRev.out test_readSiliconRev.hex
avr-size test_readSiliconRev.out
text data bss dec hex filename
3774 18 568 4360 1108 test_readSiliconRev.out
Expl.: data=initialized data, bss=uninitialized data, text=code
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -Os -c main.c
avr-gcc -g -mmcu=atmega168 -Wall -Wstrict-prototypes -Os -mcall-prologues -Wno-deprecated-declarations -
D__PROG_TYPES_COMPAT__ -o eth_rem_dev_tcp.out -Wl,-Map,eth_rem_dev_tcp.map main.o ip_arp_udp_tcp.o enc28j60.o
avr-objcopy -R .eeprom -O ihex eth_rem_dev_tcp.out eth_rem_dev_tcp.hex
avr-size eth_rem_dev_tcp.out
text data bss dec hex filename
4502 72 568 5142 1416 eth_rem_dev_tcp.out
Expl.: data=initialized data, bss=uninitialized data, text=code
done
e:\atmel\eth_rem_dev_tcp-2.17>
**udělejte s tým fórem prosím něco ** dýky
Martin Dráb:21.2.2015 19:26
Pokud něco nepřehlížím, tak ano, udělal jsi to dobře.
Po krátké době pokračuji v tomto projektu ve zdrojovém kódu jsem místo prog_char nahradil tímto PROGMEM a vyplivlo to toto při překladu
------ Rebuild All started: Project: atmega88webserver, Configuration: Debug AVR ------
Build started.
Project "atmega88webserver.cproj" (Clean target(s)):
Target "Clean" in file "E:\Vs\Compiler.targets" from project "C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\atmega88webserver.cproj" (entry point):
Task "RunCompilerTask"
Shell Utils Path E:\shellUtils
E:\shellUtils\make.exe clean
rm -rf enc28j60.o ip_arp_udp_tcp.o main.o test0.o test1.o test2.o
rm -rf enc28j60.d ip_arp_udp_tcp.d main.d test0.d test1.d test2.d
rm -rf "atmega88webserver.elf" "atmega88webserver.a" "atmega88webserver.hex" "atmega88webserver.lss" "atmega88webserver.eep" "atmega88webserver.map" "atmega88webserver.srec" "atmega88webserver.usersignatures"
Done executing task "RunCompilerTask".
Done building target "Clean" in project "atmega88webserver.cproj".
Done building project "atmega88webserver.cproj".
Build succeeded.
------ Rebuild All started: Project: atmega88webserver, Configuration: Debug AVR ------
Build started.
Project "atmega88webserver.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "E:\Vs\Compiler.targets" from project "C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\atmega88webserver.cproj" (target "Build" depends on it):
Task "RunCompilerTask"
Shell Utils Path E:\shellUtils
E:\shellUtils\make.exe all
Building file: .././enc28j60.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "enc28j60.d" -MT"enc28j60.d" -MT"enc28j60.o" -o "enc28j60.o" ".././enc28j60.c"
Finished building: .././enc28j60.c
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.c(384,68): warning: type defaults to 'int' in declaration of 'progmem_s' [enabled by default]
uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s)
^
Building file: .././ip_arp_udp_tcp.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "ip_arp_udp_tcp.d" -MT"ip_arp_udp_tcp.d" -MT"ip_arp_udp_tcp.o" -o "ip_arp_udp_tcp.o" ".././ip_arp_udp_tcp.c"
Finished building: .././ip_arp_udp_tcp.c
Building file: .././main.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o" -o "main.o" ".././main.c"
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.c(384,1): warning: '__progmem__' attribute ignored [-Wattributes]
uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s)
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,75): warning: type defaults to 'int' in declaration of 'progmem_s' [enabled by default]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,1): warning: '__progmem__' attribute ignored [-Wattributes]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
.././main.c: In function 'moved_perm':
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(96,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 301 Moved Permanently\r\nLocation: "));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(98,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("/\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(99,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("<h1>301 Moved Permanently</h1>\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(100,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("add a trailing slash to the url\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
.././main.c: In function 'print_webpage':
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(109,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(110,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("<center><p>Output is: "));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(112,17): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("<font color=\"#00FF00\"> ON</font>"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(114,17): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("OFF"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(116,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR(" <small><a href=\".\">[refresh status]</a></small></p>\n<p><a href=\"."));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(118,17): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("/0\">Switch off</a><p>"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(120,17): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("/1\">Switch on</a><p>"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(122,9): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("</center><hr><br>version 2.17, tuxgraphics.org\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
.././main.c: In function 'main':
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(243,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1>200 OK</h1>"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(247,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(248,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,plen,PSTR("<p>Usage: http://host_or_ip/password</p>\n"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\main.c(255,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 401 Unauthorized\r\nContent-Type: text/html\r\n\r\n<h1>401 Unauthorized</h1>"));
^
In file included from .././main.c:20:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
Finished building: .././main.c
Building file: .././test0.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "test0.d" -MT"test0.d" -MT"test0.o" -o "test0.o" ".././test0.c"
Finished building: .././test0.c
Building file: .././test1.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "test1.d" -MT"test1.d" -MT"test1.o" -o "test1.o" ".././test1.c"
In file included from .././test1.c:13:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,75): warning: type defaults to 'int' in declaration of 'progmem_s' [enabled by default]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,1): warning: '__progmem__' attribute ignored [-Wattributes]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
Finished building: .././test1.c
Building file: .././test2.c
Invoking: AVR/GNU C Compiler : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega88a -c -std=gnu99 -MD -MP -MF "test2.d" -MT"test2.d" -MT"test2.o" -o "test2.o" ".././test2.c"
In file included from .././test2.c:14:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,75): warning: type defaults to 'int' in declaration of 'progmem_s' [enabled by default]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,1): warning: '__progmem__' attribute ignored [-Wattributes]
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
.././test2.c: In function 'main':
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\test2.c(136,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1>200 OK</h1>"));
^
In file included from .././test2.c:14:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\test2.c(139,41): warning: passing argument 3 of 'fill_tcp_data_p' from incompatible pointer type [enabled by default]
plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<p>OK, it works</p>"));
^
In file included from .././test2.c:14:0:
C:\Users\Víťa Škrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\ip_arp_udp_tcp.h(28,17): info: expected 'const int *' but argument is of type 'const char *'
extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const PROGMEM *progmem_s);
^
Finished building: .././test2.c
Building target: atmega88webserver.elf
Invoking: AVR/GNU Linker : 4.8.1
"E:\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe" -o atmega88webserver.elf enc28j60.o ip_arp_udp_tcp.o main.o test0.o test1.o test2.o -Wl,-Map="atmega88webserver.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega88a
test0.o: In function `main':
C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././test0.c(22,1): error: multiple definition of `main'
main.o:C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././main.c:127: first defined here
test1.o: In function `main':
C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././test1.c(38,1): error: multiple definition of `main'
main.o:C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././main.c:127: first defined here
test2.o: In function `_delay_loop_1':
C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././test2.c(44,1): error: multiple definition of `main'
main.o:C:\Users\VÝŁa Őkrabal\Documents\Atmel Studio\6.2\atmega88webserver\atmega88webserver\Debug/.././main.c:127: first defined here
collect2.exe(0,0): error: ld returned 1 exit status
make: *** [atmega88webserver.elf] Error 1
The command exited with code 2.
Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "atmega88webserver.cproj" -- FAILED.
Done building project "atmega88webserver.cproj" -- FAILED.
Build FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
potřeboval bych od vás nějaké komentáře díky
Martin Dráb:28.2.2015 11:41
Co jsem pochopil z minulého zkoumání tohoto vlákna, PROGMEM není datový typ, ale makro, které překladači říká, že má s danými daty pracovat v programové paměti. Nemůžu najít, jak se to makro pořádně používá v argumentech funkcí, u deklarace je to obvykle ale takhle:
typ promenna PROGMEM = ...;
Zkusil bych to aplikovat i u těch funkcí (tzn. PROGMEM psát až za název argumentu). Otázka je, zda to opravdu půjde.
Víc asi nemá smysl dodávat, protože to již v tomto vlákně bylo řečeno.
Vítězslav Škrabal:18.3.2015 12:20
Tak jsem vyřešil místo
uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const prog_char *progmem_s)
tak
uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const char *progmem_s)
teď bych potřeboval další věc mám toto
plen=fill_tcp_data_p(buf,plen,PSTR("<input type="checkbox" id="Checkbox2" name="" value="on" style="position:absolute;left:158px;top:551px;z-index:1;">
to se nepřeloží protože ten řetezec začíná a končí " " ale v samotném řetezci je více znaků " jde to nějak obelstít ? díky
Martin Dráb:18.3.2015 13:39
Chceš-li v řetězci napsat znak uvozovek, escapuj jej zpětným lomítkem:
\"
Zobrazeno 27 zpráv z 27.