Have encountered several times before this problem, think is not too much of a problem, directly to the problem pass off, today to a little sister to solve the problem, but let me scrap a bit of trouble. So write it down on the blog.
The detailed error report for this issue that appears today is as follows:
ld /users/home/library/developer/xcode/deriveddata/basedraw-cainjridtcbolzatdpicfdxiozma/build/products/ debug-iphonesimulator/basedraw.app/basedraw normal i386 cd /users/home/ desktop/1109/basedraw export iphoneos_deployment_target=7.0 export path= "/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/ developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/ Sbin " /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/ usr/bin/clang -arch i386 -isysroot /applications/xcode.app/contents/developer/platforms/ iphonesimulator.platform/developer/sdks/iphonesimulator9.1.sdk -l/users/home/library/developer/xcode/ deriveddata/basedraw-cainjridtcbolzatdpicfdxiozma/build/products/debug-iphonesimulator -f/users/home/ Library/developer/xcode/deriveddata/basedraw-cainjridtcbolzatdpicfdxiozma/build/products/debug-iphonesimulator -filelist /users/home/ library/developer/xcode/deriveddata/basedraw-cainjridtcbolzatdpicfdxiozma/build/intermediates/basedraw.build/ debug-iphonesimulator/basedraw.build/objects-normal/i386/basedraw.linkfilelist -xlinker -rpath -xlinker @executable_path/frameworks -mios-simulator-version-min=7.0 -xlinker -objc_abi_ Version -xlinker 2 -fobjc-arc -fobjc-link-runtime -xlinker -dependency_info -xlinker /users/home/library/developer/xcode/deriveddata/basedraw-cainjridtcbolzatdpicfdxiozma/ Build/intermediates/basedraw.build/debug-iphonesimulator/basedraw.build/objects-normal/i386/basedraw_ dependency_info.dat -o /users/home/library/developer/xcode/deriveddata/ Basedraw-cainjridtcbolzatdpicfdxiozma/build/products/debug-iphonesimulator/basedraw.app/basedraw
Duplicate symbol _drawcircle in:/users/home/library/developer/xcode/deriveddata/ basedraw-cainjridtcbolzatdpicfdxiozma/build/intermediates/basedraw.build/debug-iphonesimulator/basedraw.build/ objects-normal/i386/mbcircleview.o/users/home/library/developer/xcode/deriveddata/ basedraw-cainjridtcbolzatdpicfdxiozma/build/intermediates/basedraw.build/debug-iphonesimulator/basedraw.build/ OBJECTS-NORMAL/I386/MBHUMANVIEW.O ld:1 duplicate symbol for Architecture I386clang:error:linker command failed with Exit code 1 (use-v to see invocation)
First, the brain. O what does the file mean: There are many commonly used file types in Xcode, the most common being the . H\.m\.swift, then the question came, and we did not write. O's file has been duplicated? As we all know, the Xcode compiler has to go through three steps to compile the program: Compile----> Link----> Run, which is less than three steps. So the. o file is a temporary file that is generated during the compilation phase, That means you're not even in the process of compiling. No more nonsense, here's a detailed solution to this error:
The hint of this error is clear, that is, Xcode has a duplicate file at compile time, and the direct point is the MBCIRCLEVIEW.O and mbhumanview.o the two files, then the problem comes, The culprit is in these two documents. The general solution can be considered in the following ways:
-
When importing MBCircleView.h and MBHumanView.h using import, it is possible to introduce a header file, inadvertently introducing a. m file, which generally examines the source files that are introduced to find the problem.
-
In a team collaborative development, the probability of this error is slightly larger, such as a child created a mbcircleview placed in a folder, B child also created a same name Mbcircleview placed under the B folder. When two people merge code, The compiler compiles these two files at the same time, or this error occurs.
-
In Targets's Build phrases settings, look at the next complie sources to see if the class that is having the problem is duplicated. If it is duplicated, removing the re-add will also solve the problem.
-
In the end, the question I met today, the problem is a little bit different from the above problems, first of all, the girl's code in the. m file is written in the form of the C language.
The C function in Mbcircleview is in the form of the following:
void Drawcircle ()
The C function in Mbhumanview is in the form of the following:
void Drawcircle (cgcontextref ctx, int radius, cgfloat CenterX, CGFloat centery)
What you need to know here is that if it is a function overload, the compile time only look at the file name, and do not care about how many parameters you have behind, if the file name is the same word is not. So if the fourth situation arises, the name of the function can be resolved.
Copyright Notice: This article is for the author Original, welcome reprint share. Please respect the author Labor, reproduced when the statement and the author of the blog link, thank you!
iOS development----Duplicate symbol for architecture overload issues