[Xcode] N duplicate symbols for architecture arm64
👨🏻‍💻iOS 공부/ErrorHandling

[Xcode] N duplicate symbols for architecture arm64

728x90
반응형

"N duplicate symbols for architecture arm64"

 

위와 같은 에러는 왜 발생하고, 어떻게 처리해야 할까? 

 

[원인] 

설치한 framework나 library가 엉켰을 때 주로 발생한다.  

 

[해결방안] 

1번

pod을 제거 후, 재설치해준다.

pod deintegrate
pod install

https://stackoverflow.com/questions/26303782/duplicate-symbols-for-architecture-arm64

 

Duplicate Symbols for Architecture arm64

When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. I looked online where the find these duplicates but have had no luck: Any ideas how to fix this?

stackoverflow.com

2번

build setting을 바꿔준다. 

Target > Build Settings > Apple Clang - Code Generation > No Common Blocks : No

Target > Build Settings > Apple Clang - Code Generation > No Common Blocks로 들어가 No로 바꿔준다. 

 

https://stackoverflow.com/questions/11233235/what-is-gcc-no-common-blocks-used-for

 

What is GCC_NO_COMMON_BLOCKS used for?

I found that my project sets GCC_NO_COMMON_BLOCKS = NO under Apple LLVM Compiler 3.1 - Code Generation settings, as "No Common Blocks" I would like to know: what is that flag used for? Thanks...

stackoverflow.com

 

공식문서에는 다음과 같이 나와있다. 

 

In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that the program will work on other systems which always work this way.

 

> 초기화되지 않은 전역 변수도 공통 블록으로 생성하는 대신 개체 파일의 데이터 섹션에 할당한다. 이는 두 개의 다른 컴파일에서 동일한 변수를 선언(외부 연결 없이)하면 연결할 때 오류가 발생한다. 이에 NO로 설정해주는 것 

728x90
반응형