String in Array kopieren mit Pointer

OP #4602684
Lesenswert?
• ▲
▼
Hallo,

mit dem C30 Compiler konnte ich ganz einfach so einen Text in ein Array 
schreiben:
1
unsigned char  TEXT[10];
2

3
strcpy ((char*)&DISPLAY.TEXT[0],"CHARGING");


Mit dem MPLAB XC8 geht das nicht mehr. Es kommt immer diese 
Fehlermeldung:

Main.c:52: warning: (361) function declared implicit int

C:\Program Files (x86)\Microchip\xc8\v1.36\sources\common\strcpy.c:8: 
error: (1098) conflicting declarations for variable "_strcpy" 
(Main.c:52)
(908) exit status = 1
nbproject/Makefile-default.mk:193: recipe for target 
'dist/default/debug/V01.debug.elf' failed
make[2]: Leaving directory 
'D:/Controller_Software/ePack/Display_Controller/V01'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory 
'D:/Controller_Software/ePack/Display_Controller/V01'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed


Was ist falsch?
#4603568
Lesenswert?
• ▲
▼
> #include <string.h>

Das war auch mein Gedanke, wegen:

> Main.c:52: warning: (361) function declared implicit int

> Das ist natürlich drin...

Zeig mal ein (echtes) Minimalbeispiel wo das Problem auftritt...

>
1
> unsigned char  TEXT[10];
2
> 
3
> strcpy ((char*)&DISPLAY.TEXT[0],"CHARGING");
4
>

...weil das ist fehlerhaft.

Alle Warnungen einschalten kann auch hilfreich sein.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren