简体   繁体   English

仅在Xcode C ++项目中,发布模式下的链接器错误

[英]Linker error in release mode only in Xcode C++ Project

I'm working on a project in C++ in Xcode, and it compiles and runs absolutely fine in debug mode. 我正在Xcode中使用C ++开发一个项目,它可以在调试模式下编译并运行良好。 I'm now trying to get it working in release mode, and it's coming up with many linker errors that come down to one particular library (the netcdf library I'm using, to be exact). 我现在正试图使其在发布模式下工作,并且它伴随着许多链接器错误,这些错误归结于一个特定的库(确切地说,我正在使用的netcdf库)。 The errors have the form: 错误的形式为:

  "NcVar::num_atts() const", referenced from:
      getScaling(NcVar*, double&, double&)in NetCDFHandler.o

where NetCDFHandler is my file (and getScaling is my function). 其中NetCDFHandler是我的文件(而getScaling是我的函数)。 I've had a look at the Build Settings for Debug and Release, and made sure that 'Other Linker Flats', 'Header Search Paths' and 'Library Search Paths' are all the same in both. 我查看了“调试和发布”的“构建设置”,并确保“ Other Linker Flats”,“ Header Search Paths”和“ Library Search Paths”两者都相同。 The only things that remain different are things that should remain different (such as optimisation level, and per configuration build products path). 唯一保持不同的就是应该保持不同的事物(例如优化级别和每个配置生成产品的路径)。

does anyone have any ideas where things could be going wrong? 有谁知道哪里可能出问题?

Thanks in advance! 提前致谢!

------FURTHER INFO------ ------更多信息------

The linker warning xcode throws up immediately before the first error is: 链接器警告xcode在第一个错误出现之前立即抛出:

ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/libnetcdf_c++.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

Try to clean if that doesn't help try to se if it is double of imports in your files. 尝试清理是否无济于事,如果它是文件中导入的两倍。 Last try is to check on build phase in your project to se if it it correct. 最后的尝试是检查项目的构建阶段,以确保它是否正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM