编译错误whith boost-python和lapack [英] compilation error whith boost-python and lapack

查看:754
本文介绍了编译错误whith boost-python和lapack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个程序使用boost提取python变量和lapack求解矩阵。但是我在编译过程中遇到了一些麻烦。



这是我的include和第一行代码:

  #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 
#includelapacke.h
#include< math.h>

#include< omp.h>

#include< stdlib.h>
#include< stdint.h>
#include< stdio.h>
#include< stdarg.h>
#include< math.h>
#include< sys / times.h>

#include< exception>
#include< fstream>
#include< iostream>
#include< cassert>
#include< algorithm>
#include< string>
#include< sstream>
#include< vector>
#include< map>
#include< list>
#include< set>
#include< limits>

#include< Python.h>
#include< arrayobject.h>

#include< boost / timer / timer.hpp>
#include< boost / python.hpp>
#includeboost / python / extract.hpp


使用命名空间std;

编译导致大量的错误,我很难解释这个输出。
下面是一个示例:

 在/usr/include/c++/4.9/complex.h中包含的文件中: 36:0,
来自/usr/include/lapacke.h:73,
来自/project/git/CLCCD/whittaker/wfilter.cpp:4:
/ usr / include / boost /operators.hpp:308:26:error:expected identifier before'('token
template< class T,class I,class R,class B = :: boost :: detail :: empty_base< T> ;
^
/usr/include/boost/operators.hpp:308:26:error:expected')'before'__extension__'
template< class T,class I,class R ,class B = :: boost :: detail :: empty_base< T> >
^
/usr/include/boost/operators.hpp:308:26:错误:预期'>'before'__extension__'
/usr/include/boost/operators.hpp: 308:26:error:expected unqualified-id before')'token
template< class T,class I,class R,class B = :: boost :: detail :: empty_base& >
^
在/usr/include/boost/system/error_code.hpp:17:0中包含的文件中,
来自/usr/include/boost/chrono/detail/system.hpp: 12,
从/usr/include/boost/chrono/system_clocks.hpp:64,
从/usr/include/boost/chrono/chrono.hpp:13,
从/ usr / include / boost / timer / timer.hpp:14,
从/project/git/CLCCD/whittaker/wfilter.cpp:37:
/usr/include/boost/operators.hpp:649:7 :error:'indexable'没有在这个范围内声明
,indexable< T,D,R,B
^
/usr/include/boost/operators.hpp:650:7:错误:模板参数数错误(6,应为3)
> > > > {};
^
/usr/include/boost/operators.hpp:420:8:错误:为'template< class T,class U,class B>提供。 struct boost :: additive2'
struct additive2
^
/usr/include/boost/operators.hpp:650:9:错误:模板参数2无效
> > > > {};
^
/usr/include/boost/operators.hpp:650:11:错误:模板参数3无效
> > > > {};
^
/usr/include/boost/operators.hpp:650:13:error:expected'{'before'>'token
> > > > {};
^
/usr/include/boost/operators.hpp:650:13:错误:预期未限定ID之前'>'令牌
/usr/include/boost/operators.hpp :851:1:错误:'indexable'不是'boost'的成员
BOOST_OPERATOR_TEMPLATE3(可索引)
^
/usr/include/boost/operators.hpp:851:1:错误:'indexable'不是'boost'的成员
/usr/include/boost/operators.hpp:851:1:错误:模板参数数目错误(4,应为1)
BOOST_OPERATOR_TEMPLATE3(可索引)
^
/usr/include/boost/operators.hpp:731:26:错误:提供给'template< class T> struct boost :: is_chained_base'
template< class T> struct is_chained_base {
^
/usr/include/boost/operators.hpp:851:1:错误:期望的非限定ID之前'>'token
BOOST_OPERATOR_TEMPLATE3(可索引)
^
在/usr/include/c++/4.9/complex.h:36:0中包含的文件中,
来自/ project的/usr/include/lapacke.h:73,
/git/CLCCD/whittaker/wfilter.cpp:4:
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:34:15:error:expected')'before'__extension__'
模板int I> class spinlock_pool
^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:34:15:error:expected'>'before'__extension__'
/ usr / include / boost / smart_ptr / detail / spinlock_pool.hpp:34:15:error:expected unqualified-id before')'token
template< int I> class spinlock_pool
^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15:error:expected')'before'__extension__'
template< int I> spinlock spinlock_pool< I> :: pool_ [41] =
^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15:错误:预期'>'before'__extension__'
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15:error:expected unqualified-id before')'token
template< int I> spinlock spinlock_pool< I> :: pool_ [41] =
^
//其他行...
在包含在/usr/include/boost/shared_ptr.hpp:17:0中的文件中,
从/usr/include/boost/python/converter/shared_ptr_to_python.hpp:10,
从/usr/include/boost/python/converter/arg_to_python.hpp:15,
从/ usr / include / boost / python / call.hpp:15,
从/usr/include/boost/python/object_core.hpp:14,
从/ usr / include / boost / python / args。 hpp:25,
来自/usr/include/boost/python.hpp:11,
来自/project/git/CLCCD/whittaker/wfilter.cpp:38:
/ usr / include /boost/smart_ptr/shared_ptr.hpp:在函数'boost :: shared_ptr< T> boost :: atomic_load(const boost :: shared_ptr< T> *)':
/usr/include/boost/smart_ptr/shared_ptr.hpp:954:5:error:'spinlock_pool'不是'boost :: detail'
boost :: detail :: spinlock_pool< 2> :: scoped_lock lock(p);
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:954:36:error:':: scoped_lock'尚未声明
boost :: detail :: spinlock_pool< 2> ; :: scoped_lock lock(p);
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:在函数'void boost :: atomic_store(boost :: shared_ptr< T> *,boost :: shared_ptr< T>)':
/usr/include/boost/smart_ptr/shared_ptr.hpp:965:5:错误:'spinlock_pool'不是'boost :: detail'的成员
boost :: detail :: spinlock_pool< 2> ; :: scoped_lock lock(p);
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:965:36:错误:':: scoped_lock'尚未声明
boost :: detail :: spinlock_pool< 2> ; :: scoped_lock lock(p);
^
//并继续...

Q ::我有限的编译知识往往假设lapack和boost之间有冲突,但是如何解决?



这个问题与cpp文件中定义的任何命名空间有关?

解决方案

/ p>

通过将#includelapacke.h包括进来,它解决了这些事情...



现在有其他问题...但这是另一个故事...


I created a program using boost for extracting python variables and lapack for solving matrix. However I have some trouble in compilation process

Here are my includes and the firsts line of code :

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "lapacke.h"
#include <math.h>

#include <omp.h>

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <sys/times.h>

#include <exception>
#include <fstream>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <limits>

#include <Python.h>
#include <arrayobject.h>

#include <boost/timer/timer.hpp>
#include <boost/python.hpp>
#include "boost/python/extract.hpp"


using namespace std;

The compilation results in a large amount of errors that I have difficulties to interpret this output. Here is a sample :

In file included from /usr/include/c++/4.9/complex.h:36:0,
                 from /usr/include/lapacke.h:73,
                 from /project/git/CLCCD/whittaker/wfilter.cpp:4:
/usr/include/boost/operators.hpp:308:26: error: expected identifier before ‘(’ token
 template <class T, class I, class R, class B = ::boost::detail::empty_base<T> >
                          ^
/usr/include/boost/operators.hpp:308:26: error: expected ‘)’ before ‘__extension__’
 template <class T, class I, class R, class B = ::boost::detail::empty_base<T> >
                          ^
/usr/include/boost/operators.hpp:308:26: error: expected ‘>’ before ‘__extension__’
/usr/include/boost/operators.hpp:308:26: error: expected unqualified-id before ‘)’ token
 template <class T, class I, class R, class B = ::boost::detail::empty_base<T> >
                          ^
In file included from /usr/include/boost/system/error_code.hpp:17:0,
                 from /usr/include/boost/chrono/detail/system.hpp:12,
                 from /usr/include/boost/chrono/system_clocks.hpp:64,
                 from /usr/include/boost/chrono/chrono.hpp:13,
                 from /usr/include/boost/timer/timer.hpp:14,
                 from /project/git/CLCCD/whittaker/wfilter.cpp:37:
/usr/include/boost/operators.hpp:649:7: error: ‘indexable’ was not declared in this scope
     , indexable<T, D, R, B
       ^
/usr/include/boost/operators.hpp:650:7: error: wrong number of template arguments (6, should be 3)
       > > > > {};
       ^
/usr/include/boost/operators.hpp:420:8: error: provided for ‘template<class T, class U, class B> struct boost::additive2’
 struct additive2
        ^
/usr/include/boost/operators.hpp:650:9: error: template argument 2 is invalid
       > > > > {};
         ^
/usr/include/boost/operators.hpp:650:11: error: template argument 3 is invalid
       > > > > {};
           ^
/usr/include/boost/operators.hpp:650:13: error: expected ‘{’ before ‘>’ token
       > > > > {};
             ^
/usr/include/boost/operators.hpp:650:13: error: expected unqualified-id before ‘>’ token
/usr/include/boost/operators.hpp:851:1: error: ‘indexable’ is not a member of ‘boost’
 BOOST_OPERATOR_TEMPLATE3(indexable)
 ^
/usr/include/boost/operators.hpp:851:1: error: ‘indexable’ is not a member of ‘boost’
/usr/include/boost/operators.hpp:851:1: error: wrong number of template arguments (4, should be 1)
 BOOST_OPERATOR_TEMPLATE3(indexable)
 ^
/usr/include/boost/operators.hpp:731:26: error: provided for ‘template<class T> struct boost::is_chained_base’
 template<class T> struct is_chained_base {
                          ^
/usr/include/boost/operators.hpp:851:1: error: expected unqualified-id before ‘>’ token
 BOOST_OPERATOR_TEMPLATE3(indexable)
 ^
In file included from /usr/include/c++/4.9/complex.h:36:0,
                 from /usr/include/lapacke.h:73,
                 from /project/git/CLCCD/whittaker/wfilter.cpp:4:
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:34:15: error: expected ‘)’ before ‘__extension__’
 template< int I > class spinlock_pool
               ^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:34:15: error: expected ‘>’ before ‘__extension__’
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:34:15: error: expected unqualified-id before ‘)’ token
 template< int I > class spinlock_pool
               ^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15: error: expected ‘)’ before ‘__extension__’
 template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] =
               ^
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15: error: expected ‘>’ before ‘__extension__’
/usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:75:15: error: expected unqualified-id before ‘)’ token
 template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] =
               ^
 // some other lines ...
     In file included from /usr/include/boost/shared_ptr.hpp:17:0,
                 from /usr/include/boost/python/converter/shared_ptr_to_python.hpp:10,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:15,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:25,
                 from /usr/include/boost/python.hpp:11,
                 from /project/git/CLCCD/whittaker/wfilter.cpp:38:
/usr/include/boost/smart_ptr/shared_ptr.hpp: In function ‘boost::shared_ptr<T> boost::atomic_load(const boost::shared_ptr<T>*)’:
/usr/include/boost/smart_ptr/shared_ptr.hpp:954:5: error: ‘spinlock_pool’ is not a member of ‘boost::detail’
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
     ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:954:36: error: ‘::scoped_lock’ has not been declared
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
                                    ^
/usr/include/boost/smart_ptr/shared_ptr.hpp: In function ‘void boost::atomic_store(boost::shared_ptr<T>*, boost::shared_ptr<T>)’:
/usr/include/boost/smart_ptr/shared_ptr.hpp:965:5: error: ‘spinlock_pool’ is not a member of ‘boost::detail’
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
     ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:965:36: error: ‘::scoped_lock’ has not been declared
     boost::detail::spinlock_pool<2>::scoped_lock lock( p );
                                    ^
// and it continues...

Q : My limited knowledge on compilation tends to suppose a conflict between lapack and boost, but how to resolve ?

Q : Is this a problem related to any namespace defined in cpp file ?

解决方案

In fact this was a problem in includes order...

by putting #include "lapacke.h" after boost includes, it solved the things...

I'm having other problems now... but that's another story...

这篇关于编译错误whith boost-python和lapack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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