如何添加一个C ++编译器标志extconf.rb [英] How to add a C++ compiler flag to extconf.rb

查看:86
本文介绍了如何添加一个C ++编译器标志extconf.rb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个Ruby扩展,对此我有一个标准的MKMF配置脚本,但我需要添加一个特殊标志包括:( - STD =的C ++ 0x )所有的C ++编译步骤。我不希望它在C编译步骤,因为它会引发警告。我应该怎么做呢?

I'm writing a Ruby extension, for which I have a standard mkmf configuration script, but I need to add a special include flag (--std=c++0x) to all of the C++ compilation steps. I don't want it in the C compilation steps, 'cause it throws warnings. How should I do this?

require 'mkmf'
create_makefile('thing')

例如,我试过 $ CXXFLAGS<< -I ..',但CXXFLAGS没有定义,没有。如果我使用 $ CXXFLAGS ='-I ..',它只是后来覆盖。

For instance, I tried $CXXFLAGS << '-I..', but CXXFLAGS isn't defined, yet. If I use $CXXFLAGS = '-I..', it's just overwritten later.

推荐答案

这为我工作。

$CXXFLAGS += " -std=c++11 "

这篇关于如何添加一个C ++编译器标志extconf.rb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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