Page 1 of 1
include string.h
Posted: Fri Sep 18, 2015 12:15 pm
by antoniolinux
Hi to all, i want to do porting of my little project on chibios os, i use a shield SIM900, for use this shield i use AT comand, now when I send a command this shield give me a answer, i want store this answer for controll it.
in my application i use the string type, and all work well.
In chibios i configure the serial comunication, SD3, and all work well but i can't include the string.h library.
i wire
Code: Select all
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
#include <string.h>
but i have this message "unresolve inclusion string.h" i don't know where is the problem, the chprintf work well but the string.h no.
can you help me?
best regards
Antonio
Re: include string.h
Posted: Fri Sep 18, 2015 12:48 pm
by Giovanni
Hi,
That is just an Eclipse warning, the program should compile fine.
Giovanni
Re: include string.h
Posted: Tue Sep 22, 2015 8:53 am
by antoniolinux
hi giovanni, i write this easy program
Code: Select all
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
#include <string.h>
BaseSequentialStream* chp = (BaseSequentialStream*) &SD2;
string s;
int main(void) {
halInit();
chSysInit();
sdStart(&SD2, NULL);
while (true) {
chprintf(chp, "Hello world\n\r");
chThdSleepMilliseconds(500);
}
}
if i don't include the line #include <string.h> and the line string s; all work well, but if use this two line i have this error "main.c:25:1: error: unknown type name 'string'";
i think don't load he library string.h
this is my makefile
Code: Select all
CSRC = $(STARTUPSRC) \
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
main.c
.....
INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(CHIBIOS)/os/hal/lib/streams \
$(CHIBIOS)/os/various
it's all correct or i don't see where is the error.
ciao
Antonio
Re: include string.h
Posted: Tue Sep 22, 2015 9:02 am
by Giovanni
A type named "string" is not part of C language as far I know.
Giovanni
Re: include string.h
Posted: Tue Sep 22, 2015 9:51 am
by antoniolinux
you are right, only now i see that in mbed use c++ where it is defined,
thanks
A.
Re: include string.h
Posted: Wed Jul 12, 2017 4:50 am
by petruchito
Just in case someone is annoyed by this warning like me:
Add new entry to Project properties -> Preprocessor include paths -> GNU C -> CDT user setting entries
- Path C:\ChibiStudio\tools\GNU Tools ARM Embedded\4.9 2015q3\arm-none-eabi\include
- Check "Treat as built-in"
- Check "Contains system headers"