include libcurl in XCode


#1

Hi.
How can I use curl in XCode in a new Cocos2d-x project?

  1. add Existing File libcurl.a in Frameworks folder.
  2. include curl/curl.h in appDelegate.
    But the result is “No search file or directory”
    I’m try to find a differenct Between my project and CurlTest, but I can’t find anything more.

Thank you.


#2

niwatchai singtiantrakoon wrote:

Hi.
How can I use curl in XCode in a new Cocos2d-x project?

  1. add Existing File libcurl.a in Frameworks folder.
  2. include curl/curl.h in appDelegate.
    But the result is “No search file or directory”
    I’m try to find a differenct Between my project and CurlTest, but I can’t find anything more.
    >
    Thank you.

After I was add libcurl.a from “xxxx/libs/cocos2dx/platform/third_party/ios/libraries” in a new project. The error was “Duplicate symbol _main in ……”.
How can I solve this problem?


#3

niwatchai singtiantrakoon wrote:

Hi.
How can I use curl in XCode in a new Cocos2d-x project?

  1. add Existing File libcurl.a in Frameworks folder.
  2. include curl/curl.h in appDelegate.
    But the result is “No search file or directory”
    I’m try to find a differenct Between my project and CurlTest, but I can’t find anything more.
    >
    Thank you.

Finally I can solve this problem by some luck and will share this.
The first thing I try to setup xCode to link curl/curl.h by setting in GetInfo.
But the true is setting on Project->Edit Active Target “xxxxxx” and edit Header search paths with ${SRCROOT}/libs/cocos2dx/platform/third_party/ios
The second when complie Xcode can’t find refence curl_easy_init function. Your should remove ${SRCROOT}/libs/cocos2dx/platform/third_party/android and win32 from “Library Search Paths”

Don’t forget add libcurl.a into your project framwork