简体   繁体   English

使用C预处理程序指令建立GCC / G ++链接

[英]Make GCC / G++ link using a C preprocessor directive

How can I make gcc tell ld to link with a library using a preprocessor directive from within the code itself? 如何使gcc告诉ld使用代码本身中的预处理器指令与库链接?

I have a very long, undocumented and hard to read cmake file that generates a hard to read makefile that I have to use and putting the link command right next to its #include would save me weeks of headache with no guaranteed success. 我有一个非常长的,未记录且难以读取的cmake文件,该文件生成了我必须使用的难以读取的makefile,并将link命令放在其#include旁边将为我省去数周的头痛,而无法保证成功。

There's no standard way as far as I know. 据我所知,没有标准的方法。 There are proprietary implementations, like with MS compilers, but I know of no universal way. 有专有的实现,例如MS编译器,但我知道没有通用的方法。

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

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