gpt4 book ai didi

gcc - gcc -DPIC 有什么作用?

转载 作者:行者123 更新时间:2023-12-01 01:47:09 26 4
gpt4 key购买 nike

究竟是做什么的-DPIC什么时候用 GCC 编译,什么时候真的有必要?

我发现 -fpic-fPIC生成位置无关代码。但我找不到关于 -DPIC 的任何信息.

最佳答案

这只是一个预处理器宏定义。 GCC手册说:

-D NAME

Predefine NAME as a macro, with definition 1.

-D NAME=DEFINITION

The contents of DEFINITION are tokenized and processed as if they appeared during translation phase three in a #define directive.



如果您的源代码关心它是否被编译为与位置无关的代码,这可能很有用。例如:

#ifdef PIC
/* ... */
#endif

关于gcc - gcc -DPIC 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48420552/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com