Package: g++ Version: 3.3 Use of the C99 header <complex.h> in a C library header that is then used within a C++ program causes compile/linkage problems. This problem was discovered via failing to compile small examples using the m_get function in the meschach library version included in Debian. Here is a small example of some files to show a minimal problem testcase:
****************** matfun.h ********************** #include <complex.h> extern complex** getMat(int x, int y); ***************** matfun.c ********************** #include "matfun.h" complex** getMat(int x, int y) { complex** ret; complex* v; int i; ret = (complex**) malloc(x*sizeof(complex*)); for (i=0; i < x; i++) { ret[i] = (complex*) malloc(y*sizeof(complex)); } return ret; } **************main.cc *********************************************** extern "C" { #include "matfun.h" } int main(int argc, char** argv) { complex** cp = getMat(5,5); } *************************************************************************** Error Msgs show compiler is confused by complex.h, mapping it onto C++ complex type somehow: g++ -I. -L. btest.cc -lmf In file included from /usr/include/c++/3.3/backward/complex.h:31, from matfun.h:2, from btest.cc:3: /usr/include/c++/3.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. In file included from /usr/include/c++/3.3/complex:49, from /usr/include/c++/3.3/backward/complex.h:32, from matfun.h:2, from btest.cc:3: /usr/include/c++/3.3/bits/cpp_type_traits.h:71: error: template with C linkage /usr/include/c++/3.3/bits/cpp_type_traits.h:92: error: template with C linkage /usr/include/c++/3.3/bits/cpp_type_traits.h:226: error: template with C linkage /usr/include/c++/3.3/bits/cpp_type_traits.h:266: error: template with C linkage /usr/include/c++/3.3/bits/cpp_type_traits.h:278: error: template with C linkage /usr/include/c++/3.3/bits/cpp_type_traits.h:290: error: template with C linkage In file included from /usr/include/c++/3.3/complex:50, from /usr/include/c++/3.3/backward/complex.h:32, from matfun.h:2, from btest.cc:3: etc. etc.