0

I'm developing a prototype using ARM's mbed OS. I'm newish to C++ so having syntastic working would be ideal, but it gets hung up on the import of "mbed.h".

The structure of the project is:

  • /
  • myfile.cpp
  • mbed-os/
    • mbed.h

Syntastic is saying fatal error: 'mbed.h' file not found.

How can I get Syntastic / GCC (or whatever it's using) to find the header files?

UPDATE:

Looks like including a .syntastic_cpp_config file with the following in is helping (but involved an absurdly painful process of add a line, run Syntastic, find the next missing header file):

-Imbed-os
-Imbed-os/cmsis
-Imbed-os/cmsis/TARGET_CORTEX_M
-Imbed-os/cmsis/TARGET_CORTEX_M/TOOLCHAIN_GCC
-Imbed-os/drivers
-Imbed-os/events
-Imbed-os/features
-Imbed-os/hal
-Imbed-os/platform
-Imbed-os/rtos
-Imbed-os/targets
-Imbed-os/targets/TARGET_NORDIC/TARGET_NRF5
-Imbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832
-Imbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK
-Imbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/device
-Imbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK11/device
-Imbed-os/tools

This isn't a complete list at all, but I'd almost rather just hit compiler errors at this state and work with those rather than continue hunting for header files.

GTF
  • 8,031
  • 5
  • 36
  • 59
  • With GCC you can use the option `-Imbed-os/`. The `-I` option just tells the compiler where to look for included files – Francisco Gallego Salido Nov 29 '17 at 11:42
  • Thanks @FranciscoGallegoSalido - unfortunately this isn't recursive, so it's a bit painful (see update above). – GTF Nov 29 '17 at 11:55
  • I don't think there is a way beyond defining all the compiler flags/includes on a per project basis. You could write something to parse the includes from the Makefile and put it in a `syntatic_cpp_config` file. I moved away from doing this and instead compile and load errors into the quickfix list. Btw, [Ale](https://github.com/w0rp/ale#5xiv-how-can-i-configure-my-c-or-c-project) is a much improved syntax checker as it runs asyncronously. – tuna_fish Nov 29 '17 at 12:01
  • @GTF I think all you can do is what you're now doing (searching every path that gives you errors) or use the full path when including you header files, so instead of `#include "my_header.h"`, do `#include "path/to/header/my_header.h"`, so you explicitely give the path to the file. I can't think of other solution. – Francisco Gallego Salido Nov 29 '17 at 12:01
  • @tuna_fish thanks for the recommendation for ALE, I'll check it out. – GTF Nov 29 '17 at 12:32
  • @FranciscoGallegoSalido: that's a shame, but I suppose I'll learn to live with it. Thanks! – GTF Nov 29 '17 at 12:32

1 Answers1

0

You can get an exhaustive list of flags by generating the Makefile of your project with :
mbed export -i make_gcc_arm -m K64F --profile mbed-os/tools/profiles/debug.json

cf: https://os.mbed.com/docs/v5.6/tools/debugging.html

Ithinuel
  • 116
  • 2
  • 7