如何在g ++中使用不同的STL [英] How to use a different STL with g++

查看:122
本文介绍了如何在g ++中使用不同的STL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用g ++而不是默认的libstdc ++来使用不同的STL。最简单的方法是什么?



我发现了禁止g ++查找它的STL头文件的-nostdinc ++标志,但这只是编译时的事情。它仍然会对自己的STL进行g ++链接。



所以我需要找到一种方法来禁止链接。



谢谢!

解决方案一个简单的方法是使用gcc而不是g ++编译 - 这不会链接到默认的C ++库,但仍然可以将.cpp文件编译为C ++代码。您必须在命令行中明确指定您的替代库。


I want to use a different STL with g++ instead of its default libstdc++. What is the easiest way to do this?

I found -nostdinc++ flag which inhibits g++ from looking for its STL headers but this is only a compile time thing. It will still make g++ link against its own STL.

So I need to find a way to inhibit the linking.

Thanks!

解决方案

One easy method is to build with gcc rather than g++ - this won't link in the default C++ libraries, but will still compile .cpp files as C++ code. You will have to specify your alternative libraries explicitly on the command line.

这篇关于如何在g ++中使用不同的STL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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