ikkentim / SampSharp

A framework for writing game modes for SA-MP in C#. SA-MP is a free Massively Multiplayer Online game mod for the PC version of Rockstar Games Grand Theft Auto: San Andreas.
https://sampsharp.net
Apache License 2.0
210 stars 42 forks source link

Fix `'strlen' was not declared in this scope` #429

Closed duydang2311 closed 1 year ago

duydang2311 commented 1 year ago

This error happens to me when building the plugin on Void Linux.

» make --trace  
Makefile:29: update target 'bin/obj/locator.o' due to: src/SampSharp/locator.cpp
mkdir -p bin/obj
echo g++ src/SampSharp/locator.cpp
g++ src/SampSharp/locator.cpp
g++ -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Isrc/SampSharp/includes -Isrc/SampSha
rp/includes/sdk -Isrc/SampSharp/includes/sdk/amx -DNDEBUG -DLINUX -D_GNU_SOURCE -DSAMPGDK_AMALGAMATI
ON -m32 -std=c++17 -m32 -c -o "bin/obj/locator.o" "src/SampSharp/locator.cpp"
src/SampSharp/locator.cpp: In static member function 'static bool locator::detect_lib(std::filesyste
m::__cxx11::path&, const std::string&, const std::string&)':
src/SampSharp/locator.cpp:110:20: error: 'strlen' was not declared in this scope
  110 |         runtime && strlen(runtime) > 0 && detect_lib_recursive(result, fs::path(runtime), li
b) ||
      |                    ^~~~~~

I include cstring.h just in case it's undefined to make the compiler happy.