简体   繁体   English

CLion 将现有的 .o 文件链接到项目

[英]CLion link an existing .o file to project

My professor has given us a "mystery" function - p4test.o that needs to be called from our main().我的教授给了我们一个“神秘”函数——需要从我们的 main() 调用的p4test.o

How do I add this to my CLion project to be able to call it?如何将它添加到我的 CLion 项目中以便能够调用它?

If you don't have header files for the object files you need to reverse their exports and create the header file yourself.如果您没有目标文件的头文件,您需要反转它们的导出并自己创建头文件。 From that point on you can use them from your code and link the object files in later on.从那时起,您可以在代码中使用它们,并在稍后链接目标文件。

Here is an answer that can tell you how to do this: How do i find out what all symbols are exported from a shared object?这是一个可以告诉您如何执行此操作的答案: 如何找出从共享对象导出的所有符号?

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

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