gcc和g ++链接器 [英] gcc and g++ linker

查看:147
本文介绍了gcc和g ++链接器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有进行链接,但是一旦我的项目编译完成,我将面临这个问题:


  • 一个co对象文件由gcc从纯C代码编译

  • 我有一个由g ++编译的目标文件,extern为C,用于兼容需要由co

  • 我有很多* .o目标文件,由g ++编译,由纯粹的C ++代码编写,由do部分调用


我应该如何将整个链接作为一个块共享库?使用gcc或g ++?
这个库将被Apache2用作一个C模块。使用g ++你可以链接两种类型的.o文件。只有gcc会失败。


I am not yet at the point of linking, but as soon as my project compiles I will face this issue:

  • I have one c.o object file compiled by gcc from pure C code
  • I have one d.o object file compiled by g++ with extern"C" for C compatibility of functions that needs to be callable by the c.o
  • I have a lot of *.o object files compiled by g++ from pure C++ code that are called by the d.o part

How should I link the whole as a one block shared library? Using gcc or g++? This library will then be used by Apache2 as a C module.

解决方案

Using g++ you can link both types of .o files. Only gcc will fail.

这篇关于gcc和g ++链接器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆