菜鸟教程小白 发表于 2022-12-12 21:11:26

ios - 两个 3rd 库中的重复符号错误,具有相同的 const 定义


                                            <p><p>这两个库是 AFNetworking 和 libcomScore.a。
在 AFHttpClient.h 中,<code>extern NSString * const AFNetworkingReachabilityDidChangeNotification;</code></p>

<p>在 AFHttpClient.m 中,<code>NSString * const AFNetworkingReachabilityDidChangeNotification = @"***";</code></p>

<p>在 comScore 静态库的某个类中,AFNetworkingReachabilityDidChangeNotification 被重新定义,导致错误</p>

<blockquote>
<p>duplicate symbol _AFNetworkingReachabilityDidChangeNotification in:
      comScore-iOS-ARMV7_ARMV7S_ARM64-2.1403.14/comScore-iOS-ARMV7_ARMV7S_ARM64-2.1403.14/comScore/libcomScore.a(CSReachabilityManager.o)
      /Users/apple/lib***.a(AFHTTPClient.o)</p>
</blockquote>

<p>我不想接触 AFNetworking 中的代码(尽管我可以通过重命名 const 轻松修复它。)
那么有人知道吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>检查文件的导入,您可能正在导入 <strong>.m</strong> 文件而不是 <strong>.h</strong> 文件,例如</p>

<pre><code>#import &#34;myClassName.m&#34;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 两个 3rd 库中的重复符号错误,具有相同的 const 定义,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22832434/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22832434/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 两个 3rd 库中的重复符号错误,具有相同的 const 定义