gpt4 book ai didi

c++ - 是否有可能避免在 C++ 中链接标准库

转载 作者:太空狗 更新时间:2023-10-29 20:25:31 25 4
gpt4 key购买 nike

众所周知,当我们编译和链接c++程序时,标准库是自动链接进来的。有可能避免这种情况吗?我已经编写了自己的本地库,我只想链接它。

最佳答案

是的,这是可能的,至少如果您使用的是 Visual Studio C++ 或 g++。

编译器选项

如果您使用 Visual Studio C++,请查找 option /X

如果您使用 g++,请查找选项 -nostdinc++

链接器选项

如果您使用 Visual Studio C++,请查找 option /NODEFAULTLIB .

如果您使用 g++,请查找选项 -nostdlib

关于c++ - 是否有可能避免在 C++ 中链接标准库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23533506/

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