我遇到了swig問題,對我來說,它看起來像是說我的代碼的其中一個數據成員是未定義的符號。我在網上找到了關於如何修復功能的答案,但這令我感到困惑。swig error:未定義的符號
我的錯誤是:
Traceback (most recent call last):
File "./test1.py", line 5, in <module>
from volumes import *
File "/scratch/rjkern/projects/RJKERN_volrend/scripts/volumes.py", line 26, in <module>
_volumes = swig_import_helper()
File "/scratch/rjkern/projects/RJKERN_volrend/scripts/volumes.py", line 22, in swig_import_helper
_mod = imp.load_module('_volumes', fp, pathname, description)
ImportError: /scratch/rjkern/projects/RJKERN_volrend/scripts/_volumes.so: undefined symbol: _ZN13ConstantColorC1ESt10shared_ptrI5ColorE
這是我的代碼:
/*
* ColorOperations.h
*/
#ifndef ___COLOROPS___
#define ___COLOROPS___
#include "Color.h"
#include "ProgressMeter.h"
#include "Vector.h"
#include "Volume.h"
#include "VolumeOperations.h"
#include <memory>
using namespace std;
class ConstantColor : public Volume<Color>{
shared_ptr <Color> color;
public:
ConstantColor(const shared_ptr<Color>& _color);
const Color eval(const Vector& P) const;
Color grad(const Vector& P);
};
#endif
和:
/*
* ColorOperations.cpp
*/
#include "ColorOperations.h"
ConstantColor::ConstantColor(const shared_ptr<Color>& _color){
color = _color;
}
const Color ConstantColor::eval(const Vector& P)const{
return *color;
}
感謝您使用'C++ filt'提示。這很棒! – jorgeca 2012-12-17 21:52:31