Skip to content

Commit

Permalink
Fix a linker error: undefined kMaxBufferCount (#2458)
Browse files Browse the repository at this point in the history
When building with a recent version of xt-clang and -std=c++, the linker errs on missing definition of a static constexpr class member. In C++11, static class members still had to be defined in a C++11 file and TFLM code is expected to be compatible with C++11.

BUG=323856831
  • Loading branch information
shlmregev authored Feb 16, 2024
1 parent 699564d commit ce72f7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/lite/micro/memory_planner/linear_memory_planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ limitations under the License.

namespace tflite {

// C++11 requires defining a constexpr static class member in a .cc file
constexpr int tflite::LinearMemoryPlanner::kMaxBufferCount;

LinearMemoryPlanner::LinearMemoryPlanner()
: current_buffer_count_(0), next_free_offset_(0) {}
LinearMemoryPlanner::~LinearMemoryPlanner() {}
Expand Down

0 comments on commit ce72f7b

Please sign in to comment.