开发者

Errors thrown from stl when compiling a module which uses the "Meschach" library

I'm working on a module which uses a shared library, which in turn has a static library linked to it. The shared library build works fine and generates a .so. When I try to use it in the module, I get a variety of errors, most of which are based on stl (stl collections to be specific), at the compilation stage. The errors look like:

In file included from /usr/include/c++/4.3/list:68,                             
                 from /home/gayan/LHIMo/LHI/src/CalcEngine/include/JuncNodeInfo.h:11,                                                                           
                 from /home/gayan/LHIMo/LHI/src/CalcEngine/include/RiverFlowParameter.h:11,                                                                     
                 from Main.cpp:11:                                              
/usr/include/c++/4.3/bits/stl_list.h:465:11: error: macro "catch" requires 3 arguments, but only 1 given

This is given in most places which use list, vector or map. Please help me to resolve this.

Sample code: "CalcEngine.h" in the library:

#ifndef LHI_CALCENGINE_H_
#define LHI_CALCENGINE_H_

extern "C"{
#include <matrix2.h>
}开发者_JAVA百科

class CalcEngine{

public:

protected:

};


#endif /* LHI_CALCENGINE_H_ */

Main.cpp in the application:

#include <iostream>
#include <CalcEngine.h>
#include <list>  // The compilation fails as soon as this is added

int main(int argc, char** argv){

    return -1;
}

I feel this has something to do with the matrix2.h file but could not pinpoint it. The file could be found here


Doing some googling it seems like the Meschach library has a macro called catch (defined err.h indirectly included by matrix2.h) causing c++ code having exception catching to fail. Try

#undef catch 

after you are done including the meschach headers and see if works better.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜