views:

173

answers:

1

I'm compiling a project in XCode where MySQL++ in included and linked to. For some reason, I keep getting the following compiler error:

'assert’ was not declared in this scope

originating from cpool.h, a header file that's part of MySQL++. Does anyone know why this is being triggered?

EDIT: For reference, MySQL++ was installed via Macports.

+2  A: 

The most obvious answer would be that "assert.h" is not being included or is not being found in your include path. Another explanation is that the assert macro has been undefined at some point after the header was included.

Edit: Since you say that assert.h is included, and we'll assume for the moment that it's being found since it's a standard header, then that leaves us with the last possibility I stated above i.e. that the macro has been undefined.

Since cpool.h itself will not be doing this it must be the case that assert.h is included earlier either by yourself or indirectly by another 3rd party header and the undefining happening between this and your inclusion of cpool.h. This can easily be tested by moving your cpool.h include to the top of your file.

Troubadour
The file is being included by proxy through: #include <mysql++.h>. I have moved this to the very top of the file but I'm still getting these errors.
Anonymous
@Anonymous: Is the file that includes mysql++.h a header itself?
Troubadour
Yes, but moving it the proper .cpp file still yields the same error.
Anonymous
@Anonymous: So if you create a source file with only the line `#include <mysql++.h>` in it does it compile?
Troubadour
@Anonymous: BTW, when you say you get the same error after moving your header to the top of your source file is it coming from that particular include or is it now coming from another indirect include of cpool.h later on?
Troubadour
As I have moved the #include to the source file, the error is now coming from there, again, from within that #include's file mysql++.h which included cpool.h by proxy.
Anonymous
@Anonymous: Have you tried to compile a source file with _only_ the line `#include<mysql++.h>` in it? That works for me on Linux.
Troubadour
Compiling a new source file with just that one line yields the same error.
Anonymous
@Anonymous: OK, I give up :) Sounds like the bug is genuinely in the version of MySQL++ you got from Macports.
Troubadour