google / google/fuzztest

#include <string> in fuzztest.h not found

Open
#657 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.1k
Forks
137
Avg merge
3d 6h
Merged PRs (30d)
22

Description

Hello,

I am sorry, but I am running into a problem when building a project with cmake and fuzztest.
My project is a make c project but I have changed it to a simple cmake project using the provided guide about cmake projects.
I basically have a *.c and a *.h file and would like to build them with fuzztest.

CMakeLists.txt

```
cmake_minimum_required(VERSION 3.19)
project(fuzztest)

set(CMAKE_CXX_STANDARD 17)

add_subdirectory(fuzztest)

enable_testing()

include(GoogleTest)

fuzztest_setup_fuzzing_flags()

add_compile_definitions(-DMJS_MAIN -DMJS_EXPOSE_PRIVATE -DCS_ENABLE_STDIO -DMJS_ENABLE_DEBUG -DCS_MMAP -DMJS_MODULE_LINES)

add_executable(
mjs_fuzztest
mjs_fuzz/mjs.c
mjs_fuzz/mjs.h
)

link_fuzztest(mjs_fuzztest)
gtest_discover_tests(mjs_fuzztest)
```

However when I run `cmake --build .` as described I get the following error:

```bash
[ 40%] Building C object CMakeFiles/mjs_fuzztest.dir/mjs.c.o
In file included from src/mjs_main.c:13:
/home/kali/SUT/mjsFuzzTest/fuzztest/fuzztest/fuzztest.h:18:10: fatal error: 'string' file not found
#include
```

However when I run the example from the cmake file, the first_fuzz_test.cc, everything works like a charme.

How is it possible, that clang can not find the string header?

I hope to get some suggestion, what I might be doing wrong.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.