1

I develope an application in mac that uses carbon.

My IDE is Code::Blocks (GCC compiler). My code compiles successfully but does not link.

#include <iostream>
#include <Carbon/Carbon.h>

using namespace std;

int main()
{
    //CGEventFlags flags = CGEventSourceFlagsState(1);

    while(true)
    {
        CGEventSourceStateID eventSource = kCGEventSourceStateCombinedSessionState;
        bool b = CGEventSourceKeyState(eventSource, kVK_Command) && CGEventSourceKeyState(eventSource, kVK_ANSI_Period);
        if(b)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }

    cout << "Hello world!" << endl;
    return 0;
}

How to link to the carbon with gcc in mac?

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137

1 Answers1

5

A simple -framework Carbon flag for gcc should do the trick, according to various sources around the internet.

Cannot verify this, though.

This question seems slightly similar.

Community
  • 1
  • 1
  • Seems like including Carbon.h from a C++ program will now fail to compile on mac os 10.10 with gcc. Any work around? – Alec Jacobson Nov 22 '14 at 14:30
  • @mangledorf that is both irrelevant and rather impossible for me to answer. Ask a new question with more detail than that and/or look for a solution elsewhere –  Nov 22 '14 at 15:09