amigo421
amigo421

Reputation: 2541

c++ headers like cstdio or cstdlib raise compilation errors

The following code raises many errors:

namespace ns1 {
     #include <boost/lockfree/queue.hpp>
     ...
}

/usr/include/c++/4.9/cstdlib:118: error: '::div_t' has not been declared using ::div_t; ^

/usr/include/c++/4.9/cstdlib:119: error: '::ldiv_t' has not been declared using ::ldiv_t; ^

As far as I understand the error cstdlib is in a namespace but stdlib.h is not (which is included from cstdlib and used for most definitions).

What technical solutions allow me to keep the inclusion under a custom namespace and resolve any collisions?

Upvotes: 0

Views: 980

Answers (2)

amigo421
amigo421

Reputation: 2541

I found the problem - inclusion was within a namespace

Upvotes: 1

Dominique McDonnell
Dominique McDonnell

Reputation: 2520

Usually errors like this are caused by something you included before it.

Check for classes or structs defined without a semi-colon after the closing brace.

Upvotes: 0

Related Questions