Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Wt 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)

IDE(s):

Project type:

Compiler(s):

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
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict