Yogi patel
Yogi patel

Reputation: 61

Use of undeclared identifier assert Xcode

I'm using Xcode 4.5 and LLVM 4.1 to compile some code I'm working on.

The error I am getting repeatedly is: "error: use of undeclared identifier 'assert';

The right includes are in the header (#include cassert (I have also tried #include assert.h) but no luck.

Someone else has taken my exact code and compiled it on another computer running the same setup (Mac OSX 10.8, Xcode 4.5, LLVM 4.1).

Upvotes: 4

Views: 6428

Answers (3)

drhr
drhr

Reputation: 2281

Ran into this today, I had Always Search User Paths turned on.

Upvotes: 0

dB'
dB'

Reputation: 8330

Are these errors happening in boost code? If so, you can turn off assertions (and get rid of your error) by including the following preprocessor definition in your build settings.

BOOST_DISABLE_ASSERTS

Upvotes: 0

Jay Zhu
Jay Zhu

Reputation: 41

I had exactly the same errors as yours. For my case, it turns out that there was another assert.h on the include path (CMake introduced erroneous include path for gmplib. I spotted the wrong include path when make VERBOSE=1). Not sure whether it is the same case here. LLVM itself should not have any problem with such an old header file.

Upvotes: 2

Related Questions