Linker Error while testing: Undefined symbols for architecture x86_64

985 views Asked by At

I am working to support iOS 11 and XCode 9. When I try to execute the test suite, I receive a Linker Error:

Undefined symbols for architecture x86_64

"ConstantName", reference from: - [FileATest testMethod] in FileATest.o

In FileA.h

OBJC_EXTERN NSString *const ConstantName

In FileA.m

NSString *const ConstantName = @"ConstantValue"

In FileATest.m I use the constant and have the import

#import "FileA.h"

Using a static constant in the header file seems to work, but I read that it is not the proper way to declare a constant.

It was working fine with XCode 8 and previous versions, but for XCode 9 Beta 6 it doesn't. Has someone had this problem? How may I fix it?

1

There are 1 answers

0
ebenkok On

I had the same issue when running unit tests and the solution for me was to go to the App Target > Build Settings > Dead Code Stripping and set it to NO.

Hope this helps.