I’m a newbie on JUCE. I’m now writing the several code for my apps.
I want to use some carbon APIs in my code, so I put #include <Carbon/Carbon.h> in my header file.
As the result, I’ve got several errors as follows.
/Users/hayashi/src/JUCETest/CMainContent.cpp:159: error: variable or field ‘buttonClicked’ declared void
/Users/hayashi/src/JUCETest/CMainContent.cpp:159: error: ‘int CMainContent::buttonClicked’ is not a static member of ‘class CMainContent’
/Users/hayashi/src/JUCETest/CMainContent.cpp:159: error: ‘Button’ was not declared in this scope
/Users/hayashi/src/JUCETest/CMainContent.cpp:159: error: ‘pButton’ was not declared in this scope
/Users/hayashi/src/JUCETest/CMainContent.cpp:160: error: expected ‘,’ or ‘;’ before ‘{’ token
There is a class “Button” in JUCE but there’s also “Button()” function in Carbon API.
Are there any workaroung for this or did I mistake/misunderstand something?
Thanks! I did it as you said, now it works. I added it into juce.h like this, #ifdef JUCE_MAC
#define Component JUCE_NAMESPACE::Component
#define MemoryBlock JUCE_NAMESPACE::MemoryBlock
#define Point JUCE_NAMESPACE::Point
#define Button JUCE_NAMESPACE::Button
#endif
And the prefix file of my project is now,[code]#include <Carbon/Carbon.h>
[/code]
Yeah, it works fine. Please add it in the next release if you can.
Well I’d suggest the same thing as with Windows: always include the system headers first, then the juce headers. I can make sure that always works, but can’t guarantee to make it work the other way round.