包含boost / program_options.hpp时的编译错误

时间:2014-11-16 06:05:35

标签: c++ gcc boost

这个程序编译得很好:

#include <iostream>

#include <stdio.h>

#include <boost/program_options.hpp>

int main(int argc, char* argv[]) {
    std::cout << "Hello world" << std::endl;
}

这个程序给出了一个很长的编译错误:

#include <iostream>

namespace cio {
#include <stdio.h>
}

#include <boost/program_options.hpp>

int main(int argc, char* argv[]) {
    std::cout << "Hello world" << std::endl;
}

编译错误的完全转储:http://codepad.org/aIcQqkgH

我用来编译程序的linux命令是:c ++ -o main.cpp.o -c main.cpp

1 个答案:

答案 0 :(得分:0)

只需使用

#include <cstdio>

http://en.cppreference.com/w/cpp/header/cstdio

正式要求此标头声明名称空间std内的所有旧C库声明。

但是,如果你有一个&#34;问题&#34;这需要这些&#34;解决方案&#34;,实际上只是命名自己的东西。如果实际上Boost污染了全局命名空间,那么就提交一个bug。

相关问题