(C++) assert when using the Wt library
February 24, 2017 · View on GitHub
(C++)
assert when using the Wt library
When linking to the Wt library, assert is removed from the code, as if by an NDEBUG #define (probably by the DNDEBUG #define).
The solution is to write a custom assert, like those at the page about assert.
Technical facts
Operating system(s) or programming environment(s)
Ubuntu 10.10 (maverick)
Qt Creator 2.0.0
- G++ 4.4.5
Libraries used:
Qt project file: CppWtAssert.pro
#------------------------------------------------- # # Project created by QtCreator 2011-01-12T10:38:31 # #------------------------------------------------- QT += core QT -= gui LIBS += -lwt -lwthttp QMAKE_CXXFLAGS += -DNDEBUG TARGET = CppWtAssert CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
main.cpp
#include <cassert> int main() { assert(1==2); //Should fail }