本文介绍了如何告诉Libtool使用C ++而不是C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 C ++库的Autools前端.看来Libtool正在将C源文件添加到项目中,并且在某些平台上造成了很多麻烦.我们认为它会导致无法解释的崩溃,例如来自GDB的消息启动程序终止时,信号SIGKILL终止" .

I am working on an Autools front-end for a C++ library. It looks like Libtool is adding C source files to the project and its causing a fair amount of trouble on some platforms. We think its causing unexplained crashes like Message "During startup program terminated with signal SIGKILL" from GDB.

C源文件引起故障的原因有很多.首先,我们只查询CXXFLAGS并设置AM_CXXFLAGS;并且我们对CFLAGSAM_CFLAGS不做任何事情.其次,C文件需要C ++项目中的其他选项,例如GCC下的-frtti-fexceptions以及IBM XL C/C ++编译器下的诸如-qrtti的选项.我不清楚libtool是否添加了必要的选项.第三,在使用Newlib的平台(例如Cygwin和MSYS)上,由Libtool添加的C源文件需要其他Posix选项.我们的源文件不需要这些选项.

The C source files cause trouble for several reasons. First, we only query CXXFLAGS and set AM_CXXFLAGS; and we don't do anything with CFLAGS or AM_CFLAGS. Second, C files need additional options in a C++ project, like -frtti and -fexceptions under GCC and options like -qrtti under IBM XL C/C++ compiler. Its not clear to me if libtool is adding the necessary options. Third, the C source files added by Libtool need additional Posix options on platforms that use Newlib, like Cygwin and MSYS. Our source files don't need the options.

我想强迫Libtool使用C ++而不是C,但是我无法找到这样做的选项或方法.我认为Libtool最简单的途径是使用lt-<some file>.cppCXXFLAGS而不是lt-<some file>.cCFLAGS,但是我不知道该怎么做.

I'd like to force Libtool to use C++ instead of C but I have not been able to locate an option or method to do so. I think the easiest path would be for Libtool to use lt-<some file>.cpp and CXXFLAGS rather than lt-<some file>.c and CFLAGS but I can't figure out how to do it.

我们如何告诉Libtool使用C ++而不是C?

How do we tell Libtool to use C++ and not C?

一个相关的问题是如何在C ++ Autotools项目中禁用C编译器,但仅要求使用C ++编译器用于功能测试.

A related problem is How to disable C compiler in C++ Autotools project, but it only ask to use the C++ compiler for feature testing.

推荐答案

您可以在编译之前将您提到的C编译器选项添加到CFLAGS env var中.您是否看到任何原因使它不起作用?

You could add the C compiler options you mention to the CFLAGS env var before compilation. Do you see any reasons why this would not work?

这篇关于如何告诉Libtool使用C ++而不是C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 22:45