Zhi Eng Lee libCurl duplicate symbol
Posts 36
Added by Zhi Eng Lee over 1 year ago

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?

Minggo Zhang RE: libCurl duplicate symbol
Posts 1641
Added by Minggo Zhang over 1 year ago

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

bk choi RE: libCurl duplicate symbol
Posts 11
Added by bk choi over 1 year ago

i got same trouble...
i don't know.. what i have to do...

is there any sample code?? in here?

Zhi Eng Lee RE: libCurl duplicate symbol
Posts 36
Added by Zhi Eng Lee over 1 year ago

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.

bk choi RE: libCurl duplicate symbol
Posts 11
Added by bk choi over 1 year ago

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

Zhi Eng Lee RE: libCurl duplicate symbol
Posts 36
Added by Zhi Eng Lee over 1 year ago

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

bk choi RE: libCurl duplicate symbol
Posts 11
Added by bk choi over 1 year ago

Thank you for your kindness..

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

bk choi RE: libCurl duplicate symbol
Posts 11
Added by bk choi over 1 year ago

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.

Zhi Eng Lee RE: libCurl duplicate symbol
Posts 36
Added by Zhi Eng Lee over 1 year ago

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

LiTePlayer Lee RE: libCurl duplicate symbol
Posts 3
Added by LiTePlayer Lee over 1 year ago

try set 'Other Linker Flags' field to blank.

i just solved it.

Zhi Eng Lee RE: libCurl duplicate symbol
Posts 36
Added by Zhi Eng Lee over 1 year ago

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

小 苏 RE: libCurl duplicate symbol
Posts 83
Added by 小 苏 over 1 year ago

good solution....

Siddhant Tewari RE: libCurl duplicate symbol
Posts 12
Added by Siddhant Tewari over 1 year ago

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

Alexander Perepelitsyn RE: libCurl duplicate symbol
Posts 11
Added by Alexander Perepelitsyn over 1 year ago

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

Siddhant Tewari RE: libCurl duplicate symbol
Posts 12
Added by Siddhant Tewari over 1 year ago

@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

Alexander Perepelitsyn RE: libCurl duplicate symbol
Posts 11
Added by Alexander Perepelitsyn over 1 year ago

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.

小 苏 RE: libCurl duplicate symbol
Posts 83
Added by 小 苏 over 1 year ago

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.

Alexander Perepelitsyn RE: libCurl duplicate symbol
Posts 11
Added by Alexander Perepelitsyn over 1 year ago

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


(1-17/17)