ofConstants.h: <cstdlib> file not found

I’m about to pull the hair from my head, but perhaps someone here can prevent me from going bold over this:

I’m trying to compile for iOS (SDK 5.1), when all of a sudden this error pops up.
Neither cleaning the project or restarting XCode has a proper effect.
Crazy thing is sometimes the cstdlib is clickable and shows up, sometimes it isn’t, but the compiler can never find it. What should I do?

Ended up re-downloading the whole openFrameworks for iOS package, and bit by bit moving my app there. Feels like a total waste of time so I would still like to figure out what happens when you get these errors. Is it iOS 5.1 SDK related perhaps?

It’s project configuration related, though how your compiler couldn’t find the c standard library is beyond me. I’d imagine that it’s just corruption/misconfiguration in the project file itself.

in my case, I saw that several times when using pure objectiveC stuff.
putting all .m extra classes into .mm solved that

a reference is required: http://wiki.openframeworks.cc/index.php?title=OfxiPhone-comprehensive-guide#.cpp-vs.-.mm

Oh interesting, that’s the error from not have the files as .mm? Very unintuitive, but good to know that it’s on the wiki.

I’m quite sure it can be that too, here.
But not 101% sure of course.

in my case, it solved stuff when trying to use UI Kit, some objC classes implementation files (initially as .m)

[quote=“julien, post:4, topic:9363”]
in my case, I saw that several times when using pure objectiveC stuff.
putting all .m extra classes into .mm solved that[/quote]

That’s what exactly what I was using, an objective-c class, and changing from .m to .mm fixed it!
Thanks Julien!

glad to have solved my first problem here :slight_smile:

Thanks you for this I’ve been trying to figure this bug out for weeks!!!

Does anyone know why the switch from .m to .mm actually solves it?

Cheers

-A

ObjectiveC is build on top of C, not C++
OF is C++

.m is usually used for ObjectiveC
.mm would mean ObjectiveC++ which is only a trick for the compiler, afaik.