Skye
Skye

Reputation: 300

CMake: "fatal error: cstdio: No such file or directory"

I'm trying to CMake a project. I'm new to using it so I guess it must be very obvious for someone familiar with CMake: In the main folder where main.c is residing I'm including

#include "tensorflow/lite/micro/all_ops_resolver.h"

This library is found. Inside the file all_ops_resolver.h is a line:

#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"

Inside the micro_mutable_op_resolver.h file is another line:

#include <cstdio>

Now this triggers an error by CMake:

> In file included from
> ../main/tensorflow/lite/micro/all_ops_resolver.h:19,
>                  from ../main/main.c:16: ../main/tensorflow/lite/micro/micro_mutable_op_resolver.h:18:10: fatal
> error: cstdio: No such file or directory  #include <cstdio>
>                                                    ^~~~~~~~ 
> compilation terminated.`

The file stdio.h would be located in:

~/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include

which is outside the project directory. I can't figure out what should go into which CMakeLists.txt to point the compiler to that folder. Can someone help?

Upvotes: 1

Views: 9167

Answers (2)

MikeCAT
MikeCAT

Reputation: 75062

#include <cstdio>

is for C++.

You are using C, so you should use

#include <stdio.h>

instead.

Upvotes: 5

user14215102
user14215102

Reputation:

#include <cstdio>

is a C++ header and the micro_mutable_op_resolver.h header file seems to be from TensorFlow Lite for Microcontrollers which is a C++ library, so you should probably change your main.c to main.cpp and compile as C++.

Upvotes: 6

Related Questions