Projectitis
Projectitis

Reputation: 383

How to compile a debug static library using LLVM clang

I am compiling a static library (Rive in this case) with iterator debug level of 2, to be compatible with all my other static libs in this project. The toolset is LLVM clang on Windows, targeting x64.

Side note: The Rive project uses a different build system (premake5) than the others I have compiled, which have used cmake.

I am getting an error during compile #error _ITERATOR_DEBUG_LEVEL > 1 is not supported in release mode.. However, from what I can tell, I am NOT compiling in release mode. Why might I be getting the error about "release mode"?

Here is an example compiler command:

clang++   -MMD -MP -D_USE_MATH_DEFINES -DDEBUG -D_ITERATOR_DEBUG_LEVEL=2 -I../include -m64 -g -std=c++17 -Wall -fno-exceptions -fno-rtti -MTd  -o \"obj/debug/cubic_asymmetric_vertex_base.o\" -MF \"obj/debug/cubic_asymmetric_vertex_base.d\" -c \"../src/generated/shapes/cubic_asymmetric_vertex_base.cpp\"",...)

From what I can tell, -g is generating debug symbols and -MTd specifies debug static library. Why is the error telling me I'm in release mode?

Upvotes: 1

Views: 895

Answers (1)

Projectitis
Projectitis

Reputation: 383

The following two things combined solved this problem for me:

  1. Pass in the flag _DEBUG as well as DEBUG
  2. Run make using PowerShell instead of bash

This allowed me to compile a static library in debug mode with _ITERATOR_DEBUG_LEVEL of 2.

Upvotes: 0

Related Questions