2013-03-06 135 views
0

我刚刚安装了trilinos 11.0.3,现在我正在尝试使用cmake编译我的第一个应用程序。编译trilinos程序

我试图编译的文件是在这里 http://code.google.com/p/trilinos/wiki/EpetraSimpleVector

第一个命令cmake似乎工作,虽然我得到以下警告(以防万一它相关的)每个trilinos包:

CMake Warning (dev) at /home/giorgos/Documents/TRILINOS/lib/cmake/Trilinos/ 
    TrilinosTargets.cmake:208 (ADD_LIBRARY):   
    ADD_LIBRARY called with SHARED option but the target platform does not 
    support dynamic linking. Building a STATIC library instead. This may lead 
    to problems. 

除此之外,似乎trilinos的位置包含并且库已被正确找到

但是,make命令会生成一个simi列表lar错误,如:

/home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:11: 
    undefined reference to `Epetra_SerialComm::Epetra_SerialComm()' 

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:16: 
    undefined reference to `Epetra_Map::Epetra_Map(int, int, Epetra_Comm const&)' 

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:19: 
    undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)' 

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:20: 
    undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)' 

任何想法这里发生了什么?

(我命名为源文件teuchos_test.cpp因为首先我试图编译从teuchos包装一些代码,但是我收到了如上类似的错误)

谢谢

Giorgos

回答

-1

我没有能够用cmake编译trilinos的例子,但我可以通过链接我自己的一切来实现。对于给我的上述错误的例子我做了以下

g++ -o teuchos_test teuchos_test.cpp \ 
    -I/home/giorgos/Documents/TRILINOS/include \ 
    -L/home/giorgos/Documents/TRILINOS/lib -lepetra 

,因为它仅依赖于epetra包(我还是要改名字:))

但是如果有谁知道如何编译与cmake trilinos我会很欣赏这里输入

+0

你使用[这个例子](http://code.google.com/p/trilinos/wiki/CMakeFindPackageTrilinosExample)? – Fraser 2013-03-07 23:16:40

+0

感谢您的发现! 我使用了Trilinos的类似软件,但没有太多解释性评论。我会试一试 – giorgk 2013-03-08 23:51:45

+0

这就是我的做法: 将http://trilinos.sandia.gov/Export_Makefile_example.txt 的内容复制到一个空的Makefile中。 在第一个以单词include开头的命令中,您必须提供安装的“Makefile.export.Trilinos”文件的路径。 接下来使用正确的名称更改库和源文件的名称,并执行make“MyApp.exe”,其中“MyApp.exe”是用来替换Makefile中的“MyApp.exe”的名称。 我希望这会有所帮助。 – giorgk 2013-06-27 19:44:14