简体   繁体   English

编译C库时的警告

[英]Warnings while compiling a C library

I am trying to compile a C library and I am getting a loy of warning while doing it. 我正在尝试编译C库,并且在执行该操作时会发出警告。 Though the compiled library is working properly, I am still a bit apprehensive about the warnings. 尽管已编译的库运行正常,但我对警告仍然有些担心。 I googled all the warnings, but the relevant search results are hard to come by. 我搜索了所有警告,但很难找到相关的搜索结果。

The warnings are: 警告是:

main(){printf("osx%d", (int) (sizeof(void *)*8));} ^~~~ 1 warning generated. clang: warning: argument unused during compilation: '-s'

This warning is in the shell script that I used to compile the libraries. 这个警告在我用来编译库的shell脚本中。 Could someone tell me what the -'s' flag is and how I can remove this warning? 有人可以告诉我-的标志是什么以及如何删除此警告?

Next warning: 下一个警告:

warning: unknown warning option '-Wno-long-double'; did you mean '-Wno-long-long'? [-Wunknown-warning-option]

and the next one, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: fortify.o has no symbols clang: warning: argument unused during compilation: '-s' 下一个是/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: fortify.o has no symbols clang: warning: argument unused during compilation: '-s'

Anyway to silence these warning? 无论如何要使这些警告静音?

Look at the manual of gcc for details of what each option should do. 请参阅gcc手册,详细了解每个选项应执行的操作。

AFAICT, clang not accepting those flags does not lead to any failure of the built executable. AFAICT,不接受这些标志的clang不会导致生成的可执行文件失败。

Excerpt: 摘抄:

  • -s: Remove all symbol table and relocation information from the executable. -s:从可执行文件中删除所有符号表和重定位信息。 (linker) (链接器)
  • -Wno-long-double: Looks like someone wants to disable use of long double . -Wno-long-double:好像有人要禁用long double使用。 Cannot find it for newest GCC. 找不到最新的GCC。 Chances are the code does not contain such anyway. 该代码可能不包含此类代码。

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

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