Adam Haile
Adam Haile

Reputation: 31349

missing ';' before namespace when using boost 1.4.2

Working on moving some C++ code from Linux over to Windows. The code uses boost 1.4.2, however it keeps failing out on building the boost modules. Basically, every boost hpp file that happens to contain "namespace boost" errors with:

error C2143: syntax error : missing ';' before 'namespace' 

Any idea what could be causing this?

Upvotes: 1

Views: 1339

Answers (2)

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99635

Loss of ; before including Boost header could be cause of that. The following code produce such error:

struct X {}  // << ; lost here

#include <boost/shared_ptr.hpp>

This small code gives me the following error:

boost/config/suffix.hpp(460) : error C2143: syntax error : missing ';' before 'namespace'

Upvotes: 5

sbi
sbi

Reputation: 224129

Have you tried including these boost headers on the first line? If they compile fine that way, it's likely a missing ; in one of the headers included before them.

Upvotes: 0

Related Questions