如何确保++与 boost 和 g++ 一起使用3.4.x
我有 Linux 开发环境,包括 g++ 3.4.6、boost 1.47(最新)和 Insure++。 在我添加 boost 之前,一切都编译得很好。在我尝试使用仅 boost 标头库编译简单测试后,我得到了这个:
11/3/11 8:58:37 AM CET: insure g++ -Zstl -Zop /root/.pulse2-agent/data/work/insure/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp
11/3/11 8:58:37 AM CET: [container_fwd.hpp:64] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class charT, class traits, class Allocator> class basic_string;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:87] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class T, class Allocator> class vector;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:88] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class T, class Compare, class Allocator> class map;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:89] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class T, class Compare, class Allocator>
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:91] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class Compare, class Allocator> class set;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:92] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class Compare, class Allocator> class multiset;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: Driver: error executing "Run "-Zoicompiler /usr/local/bin/g++" -Zstl -Zop /root/.pulse2-agent/data/work/insure/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp"
没有 Insure++,它编译得很好。不幸的是,由于内部项目结构,我无法将编译器更改为新编译器。
知道真正的问题是什么以及我该如何解决这个问题吗?
/edit
我在某处读到,此类问题可能是由升压本身中不正确的前向声明引起的。所以我在 boost headers 之前添加到我的测试中:
#define BOOST_DETAIL_NO_CONTAINER_FWD
现在它没有报告任何问题,但在编译过程中完全崩溃:
insure g++ -Zstl -Zop /root/x-formation-pk/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp
Driver: error executing "Run "-Zoicompiler /usr/local/bin/g++" -Zstl -Zop /root/x-formation-pk/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp"
makepp: error: Failed to build targets `/root/x-formation-pk/shared/generic/test/temp/linux_x86/test_boost.lob' `/root/x-formation-pk/shared/generic/test/temp/linux_x86/test_boost.o' [2]
I have linux development environment with g++ 3.4.6, boost 1.47 (latest) and Insure++.
Before I added boost everything was compiling fine. After I tried to compile simple test using boost header only libraries I get this:
11/3/11 8:58:37 AM CET: insure g++ -Zstl -Zop /root/.pulse2-agent/data/work/insure/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp
11/3/11 8:58:37 AM CET: [container_fwd.hpp:64] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class charT, class traits, class Allocator> class basic_string;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:87] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class T, class Allocator> class vector;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:88] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class T, class Compare, class Allocator> class map;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:89] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class T, class Compare, class Allocator>
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:91] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class Compare, class Allocator> class set;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: [container_fwd.hpp:92] **PARSE_ERROR**
11/3/11 8:58:37 AM CET: Parse error.
11/3/11 8:58:37 AM CET: >> template <class Key, class Compare, class Allocator> class multiset;
11/3/11 8:58:37 AM CET: too few template parameters -- does not match previous declaration
11/3/11 8:58:37 AM CET: Driver: error executing "Run "-Zoicompiler /usr/local/bin/g++" -Zstl -Zop /root/.pulse2-agent/data/work/insure/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp"
Without Insure++ it compiles just fine. Unlucky I cannot change compiler to new one because of internal project structure.
Any idea what is the real problem and how I can solve this?
/edit
I read somewhere that problems of that kind could be caused by incorrect forward declarations in the boost itself. So I added to my test before boost headers:
#define BOOST_DETAIL_NO_CONTAINER_FWD
And now it doesn't report any problems, but crashing completely during the compilation:
insure g++ -Zstl -Zop /root/x-formation-pk/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp
Driver: error executing "Run "-Zoicompiler /usr/local/bin/g++" -Zstl -Zop /root/x-formation-pk/shared/misc/insure.opt -c -DXF_PROFILE -o temp/linux_x86/test_boost.o -Wall -Werror -pthread -g -I. -I../../../shared/libs/libtommath-0.41 -I../../../shared/libs/expat-1.95.8/lib -I../../../shared/generic -I../../../shared/test -I../../../shared/libs/sentinel_hasp -I../../../shared/libs/sqlite -I../../../shared/generated -I/boost test_boost.cpp"
makepp: error: Failed to build targets `/root/x-formation-pk/shared/generic/test/temp/linux_x86/test_boost.lob' `/root/x-formation-pk/shared/generic/test/temp/linux_x86/test_boost.o' [2]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,我从 Parasoft 得到了确认,我发现了一个错误。
他们将尝试解决此问题,问题已经创建。
Actually I get the confirmation from Parasoft that I found a bug.
They will try to fix this, issue is already created.