体系结构的未定义符号 x86_64 _cJSON 试图编译测试应用程序
Undefined symbols for architecture x86_64 _cJSON trying to compile test app
我正在尝试使用以下方式进行编译:
cc -I ./curl-7.58.0/include/curl -I ./cJSON-master alexa_request_simple_demo.c
我收到了标题中所述的错误。 Curl 和 cJSON 在我的 MBP 上都可以正常编译。我试过包括
-L ./cJSON-master/build
但我得到了同样的错误。
Undefined symbols for architecture x86_64:
"_cJSON_AddFalseToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddItemToArray", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddItemToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddNumberToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddStringToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_CreateArray", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_CreateObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_Delete", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_Print", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_easy_cleanup", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_easy_init", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_easy_setopt", referenced from:
_curl_send_audio_cfg in alexa_request_simple_demo-48b802.o
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_easy_strerror", referenced from:
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
"_curl_formadd", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_formfree", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_add_handle", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_cleanup", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_fdset", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_info_read", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_init", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_perform", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_remove_handle", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_setopt", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_timeout", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_slist_append", referenced from:
_curl_send_audio_cfg in alexa_request_simple_demo-48b802.o
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
"_curl_slist_free_all", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_version", referenced from:
_main in alexa_request_simple_demo-48b802.o
ld: symbol(s) not found for architecture x86_64
好的。所以我需要 -l 两个库的 dynlib 文件(菜鸟错误)
gcc -I ./curl-7.58.0/include/curl alexa_request_simple_demo.c -I ./cJSON-master -L ./cJSON-master/build ./libcjson.1.7.1.dylib ./libcurl.4.dylib
我正在尝试使用以下方式进行编译:
cc -I ./curl-7.58.0/include/curl -I ./cJSON-master alexa_request_simple_demo.c
我收到了标题中所述的错误。 Curl 和 cJSON 在我的 MBP 上都可以正常编译。我试过包括
-L ./cJSON-master/build
但我得到了同样的错误。
Undefined symbols for architecture x86_64:
"_cJSON_AddFalseToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddItemToArray", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddItemToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddNumberToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_AddStringToObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_CreateArray", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_CreateObject", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_Delete", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_cJSON_Print", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_easy_cleanup", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_easy_init", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_easy_setopt", referenced from:
_curl_send_audio_cfg in alexa_request_simple_demo-48b802.o
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_easy_strerror", referenced from:
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
"_curl_formadd", referenced from:
_curl_sync_state in alexa_request_simple_demo-48b802.o
_curl_send_audio_content in alexa_request_simple_demo-48b802.o
"_curl_formfree", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_add_handle", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_cleanup", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_fdset", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_info_read", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_init", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_perform", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_remove_handle", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_setopt", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_multi_timeout", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_slist_append", referenced from:
_curl_send_audio_cfg in alexa_request_simple_demo-48b802.o
_curl_downchannel_cfg in alexa_request_simple_demo-48b802.o
_curl_ping_cfg in alexa_request_simple_demo-48b802.o
"_curl_slist_free_all", referenced from:
_main in alexa_request_simple_demo-48b802.o
"_curl_version", referenced from:
_main in alexa_request_simple_demo-48b802.o
ld: symbol(s) not found for architecture x86_64
好的。所以我需要 -l 两个库的 dynlib 文件(菜鸟错误)
gcc -I ./curl-7.58.0/include/curl alexa_request_simple_demo.c -I ./cJSON-master -L ./cJSON-master/build ./libcjson.1.7.1.dylib ./libcurl.4.dylib