The problem was related to the fact that, when compiling in C++11
standard mode (--std=c++11), the compiler/library would not let us use
the (non-C++11-standard) strdup()/_strdup() functions. However, the C
code was not affected (and the cmake function detection function was
not affected as well and was detecting the functions as available). We
have to compile in C++11-with-extensions mode (--std=gnu++11) in order
to get them.
include(CheckCXXCompilerFlag)
if(NOT __VISUALC__ AND NOT __BORLANDC__)
- CHECK_CXX_COMPILER_FLAG("-std=c++11" HAVE_CXX11)
- CHECK_CXX_COMPILER_FLAG("-std=c++0x" HAVE_CXX0X)
+ CHECK_CXX_COMPILER_FLAG("-std=gnu++11" HAVE_CXX11)
+ CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" HAVE_CXX0X)
if(HAVE_CXX11)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
elseif(HAVE_CXX0X)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
else()
message(STATUS "Missing support for C++11.")
endif()
{
char *res = NULL;
if (s) {
-# if !defined(_XBT_WIN32)
res = strdup(s);
-# else
- res = _strdup(s);
-# endif
if (!res)
xbt_die("memory allocation error (strdup returned NULL)");
}
return res;
}
#else /* non __GNUC__ */
-# if !defined(_XBT_WIN32)
-# define xbt_strdup(s) strdup(s)
-# else
-# define xbt_strdup(s) _strdup(s)
-# endif
+# define xbt_strdup(s) strdup(s)
# define xbt_malloc(n) malloc(n)
# define xbt_malloc0(n) calloc(n,1)
# define xbt_realloc(p,s) realloc(p,s)