libCurl duplicate symbol

Hi there. I included libcurl (which came with cocos2d-x by default in thirdparty folder) into my project but I get this error:

ld: duplicate symbol _main in /Users/zhieng/Documents/MyProject/libs/cocos2dx/platform/third_party/ios/libraries/libcurl.a(main.o) and /Users/zhieng/Documents/MyProject/build/MyProject.build/Debug-iphonesimulator/MyProject.build/Objects-normal/i386/main.o

any idea what does that mean?

Have you resolved it?
May be you should refer CurlTest.
It uses libcurl.so.

i got same trouble…
i don’t know… what i have to do…

is there any sample code?? in here?

Thanks Minggo Zhang. I haven’t try it yet (doing some other stuff) but I will definitely check out the sample file, thanks.

bk choi feel free to tell us your problem.

I was try to added “libcurl.a” and “Header” files to Libs Folder!
and then error!

I want konw how to add the ‘curl lib files’ in my project.

I think libcurl.a is got a ‘main()’ method…
but i cannot fix it!

>> this is the message
ld: duplicate symbol _main in /Users/dongsugim/Desktop/eclipse/DevLib/cocos2d-1.0.1-x-0.10.0/BKWorld/libs/cocos2dx/platform/third_party/ios/libraries/libcurl.a(main.o) and /Users/dongsugim/Desktop/eclipse/DevLib/cocos2d-1.0.1-x-0.10.0/BKWorld/build/BKWorld.build/Debug-iphonesimulator/BKWorld.build/Objects-normal/i386/main.o

You can try Minggo Zhang’s suggestion. There is a sample folder in cocos2dx called CurlTest.

Thank you for your kindness…

but where is the suggestion menu… i cannot find…
Sorry I can not yet fluent.

i found it!

but it’s not a truble…
the real truble is a………

Just add files, it was just an error that occurs is a real problem.

Let’s harder to find.

Thanks for the info bk choi. I will try it out once my current task is done. :slight_smile:

try set ‘Other Linker Flags’ field to blank.

i just solved it.

It works! Thanks!
Yeap, the solution is to set ‘Other Linker Flags’ field to blank.

good solution….

my ‘Other Linker Flags’ is empty but still the same problem is happening … has anyone solved this problem … please help ….

This bug us reproducing by adding “-all_load” flag into “Other Linker Flags” setting of executable target. Please, fix it.

@Alexandar … thanks a lot … wasted a complete day in clearing the “Other Linker Flags” for the project …… instead i should have been doing the same for the target (By selecting the required target from the Targets and then selecting info) … thanks again

Unfortunately, this isn’t a total solution. Some frameworks on ios requires using of “-all_load” flag, Openfeint for example.
I know that Openfeint may be compiled from sources, but compilation time become huge.

yes,i meet the same problem!
i solved it by set ‘Other Linker Flags’ field to blank!
but if some other framework on ios requires using of “~~all_load" flag or "~~ObjC”,
xcode report error ld: duplicate symbol _main in /Users/zhieng/Documents/MyProject/libs/cocos2dx/platform/third_party/ios/libraries/libcurl.a(main.o) and /Users/zhieng/Documents/MyProject/build/MyProject.build/Debug-iphonesimulator/MyProject.build/Objects-normal/i386/main.o
pls help.

Hm. I’m usin -ObjC flag with Openfeint, but it works normal. With all_load flag i’ve ‘ld’ errors.
I’ve found a working for me solution for avoid using of “-all_load” flag: http://blog.binaryfinery.com/universal-static-library-problem-in-iphone-sd