OSX 10.8에서 컴파일 할 때 아래 코드가 왜 링크되지 않습니까? 어떻게 10.8과 10.9에서 작동 할 수 있도록 링크를 만들 수 있습니까? 나는 clang ++ 5.1을 사용하고 있습니다.weak_import가 링커 오류를 생성합니다.
// MyFile.cc
// Compile with: clang++ MyFile.cc -framework ApplicationServices
#include <ApplicationServices/ApplicationServices.h>
#include <iostream>
extern "C" CFStringRef kAXTrustedCheckOptionPrompt __attribute__ ((weak_import));
extern "C" Boolean AXIsProcessTrustedWithOptions (CFDictionaryRef options) __attribute__ ((weak_import));
static bool IsSupported (void)
{
return AXIsProcessTrustedWithOptions ?
AXIsProcessTrustedWithOptions (NULL):
AXAPIEnabled() || AXIsProcessTrusted();
}
int main (void)
{
std::cout << (IsSupported() ? "SUPPORTED\n" : "NOT SUPPORTED\n");
return 0;
}
참고 : 모든 것이 10.9에서 작동하고 10.8에서 진 작품.
감사합니다. 저는 Windows 개발자이며 항상이 작업을 수행합니다. 필자는 약한 링크가 자동으로이 작업을 자동으로 수행 할 것이라고 생각했기 때문에 문서가 약간 혼란 스러웠습니다. – Dave