程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> ubuntu-Linux 下編譯C出錯(windows編譯正常)

ubuntu-Linux 下編譯C出錯(windows編譯正常)

編輯:編程解疑
Linux 下編譯C出錯(windows編譯正常)

Ubuntu 15
gcc version 5.2.1
錯誤:
圖片說明

scritpt.hpp下是一個 命名空間
namespace script{
....
int setData( PyObject * pObj, Vector4 & rVal, const char * varName = "" );
int setData( PyObject * pObj, Matrix & rVal, const char * varName = "" );
int setData( PyObject * pObj, PyObject * & rVal,
const char * varName = "" );
int setData( PyObject * pObj, SmartPointer & rPyObject,
const char * varName = "" );
int setData( PyObject * pObj, Capabilities & rCaps,
const char * varName = "" );
int setData( PyObject * pObj, std::string & rString,
const char * varName = "" );
int setData( PyObject * pObj, std::wstring & rString,
const char * varName = "" );
int setData( PyObject * pObj, char * & rString,
const char * varName = "" );
int setData( PyObject * pObj, Mercury::Address & rAddr,
const char * varName = "" );

template <class T>
PyObject * getReadOnlyData( const T & d )
{
    return getData( d ); //出問題的地方126行
}

PyObject * getData( const bool data );
PyObject * getData( const int data );
PyObject * getData( const uint data );
....

}

stl_to_py.cpp
PyObject * Script::getData( const PySTLSequenceHolderBase & holder ) //出錯位置
{
return new PySTLSequence(
const_cast(holder), holder.pOwner() );
}

stl_to_py.hpp 中
namespace Script
{
int setData( PyObject * pObject, PySTLSequenceHolderBase & data,
const char * varName = "" );

PyObject * getData( const PySTLSequenceHolderBase & data );

};

不知道哪裡出錯了,求大神指點

是有定義了的
定義在st_to_py.hpp中
note:
stl_to_py.cpp:506 'PyObjest * Script::getData(const PySTLSequenceHoldBase &) ' declared here ,later in the translation unit
PyObjest * Script::getData(const PySTLSequenceHoldBase & holder)

st_to_py.hpp 是 include了 script.hpp

這個在window環境下是能編譯通過的

最佳回答:


把聲明放前面試試:

PyObject * getData( const bool data );
PyObject * getData( const int data );
PyObject * getData( const uint data );

 template <class T>
PyObject * getReadOnlyData( const T & d )
{
    return getData( d ); //出問題的地方126行
}


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved