如何在mac中使用gcc链接到carbon?

Ami*_*yan 1 c++ macos macos-carbon

我在 mac 中开发了一个使用碳的应用程序。

我的 IDE 是 Code::Blocks(GCC 编译器)。我的代码编译成功但没有链接。

#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;
}
Run Code Online (Sandbox Code Playgroud)

如何在mac中使用gcc链接到carbon?

小智 5

-framework Carbon根据互联网上的各种消息来源,gcc的简单标志应该可以解决问题。

但是,无法验证这一点。

这个问题似乎有点相似。