PlatformIO Community

Unable to build unit test with platform native

Good evening,

I’m having a hard time building a unit test and it seems to be failing because there are header files missing (or a path not set). Further down is a description of my environment.

When I click on the ‘Test’ under advanced in the Platform IO tasks I get:

Building…
In file included from lib\cmdBuffer\cmdBuffer.cpp:6:
lib\cmdBuffer/cmdBuffer.h:11:26: error: ‘uint8_t’ has not been declared
11 | size_t readToEnd(uint8_t * dest);
| ^~~~~~~
lib\cmdBuffer/cmdBuffer.h:12:21: error: ‘uint8_t’ has not been declared
12 | int readCmd(uint8_t * dest);
| ^~~~~~~
lib\cmdBuffer/cmdBuffer.h:13:22: error: ‘uint8_t’ has not been declared
13 | size_t write(uint8_t * data, size_t n);
| ^~~~~~~
lib\cmdBuffer/cmdBuffer.h:20:20: error: ‘uint8_t’ was not declared in this scope
20 | ringbuffer<uint8_t>* rbSerBuf; // Holds commands
| ^~~~~~~
lib\cmdBuffer/cmdBuffer.h:1:1: note: ‘uint8_t’ is defined in header ‘’; did you forget to '#include '?
+++ |+#include

and so on…

It was working for me before and then I tried to add in support for debugging only to find that I had no gdb installed (I’m using Windows 10). I followed the instructions on Get Started with C++ and Mingw-w64 in Visual Studio Code to get what I understood to be a working debug environment. I have added C:\msys64\mingw64\bin to my path and that is where the binaries are for the compiler and debugger.

After having gone through these steps I am no longer able to build my unit test. I am still able to build the main project with g++ using the Build Task in Platform IO.

When I open a PlatformIO terminal in VS Code I can see that I have GNU gdb (GDB) 11.1, g++.exe (Rev5, Built by MSYS2 project) 11.2.0, and gcc.exe (Rev5, Built by MSYS2 project) 11.2.0 installed by using the --version flag.

Any help is appreciated.

Thanks,

Steve

Does this header file properly declare

#include <stdint.h>

at the top and thus doesn’t rely on the includer doing a #include <Arduino.h> first which would include t hat header?

2 Likes

Well that is embarrassing. I’m clearly pretty new to this, but that one is really embarrassing.

Thank you.