Hi Paolo, please try to keep the conversation on the mailing list. it may be useful for others. (and this way it will more easily be found by your favorite search engine.)
On Sunday, June 22, 2014 09:52:50 you wrote:
> Thanks for your help.
> Since the problem seems to be with library linking, I restricted the
> testing to what it seems the simplest source file to compile
> (opm-core/tutorials/tutorial1.cpp).
>
> First...
> tutorial1.cpp compiles and runs internally to opm-core using cmake
> I will follow your advice to add my developments within this framework,
> using cmake to compile.
> And I will be happy to share my developments using github pull requests
> when i have something worth share.
good :)
> Second ....
> I would still like to understand why I was failing to call components of
> the opm library externally. Calling opm library components from external
> software can always be useful.
> When I copy tutorial1.cpp to an external directory, and i try to link it to
> the opm-core library, I get the following errors:
>
> ////////////////////////////////////////////////////////////////////////////
> /// /tmp/ccgpdkx6.o: In function `main':
> tutorial1.cpp:(.text+0xd2): undefined reference to
> `Opm::GridManager::GridManager(int, int, int, double, double, double)'
> tutorial1.cpp:(.text+0x115): undefined reference to
> `Opm::GridManager::c_grid() const'
> tutorial1.cpp:(.text+0x12e): undefined reference to
> `Opm::writeVtkData(UnstructuredGrid const&, std::map<std::string,
> std::vector<double, std::allocator<double> > const*,
> std::less<std::string>, std::allocator<std::pair<std::string const,
> std::vector<double, std::allocator<double> > const*> > > const&,
> std::ostream&)'
> tutorial1.cpp:(.text+0x15b): undefined reference to
> `Opm::GridManager::~GridManager()'
> tutorial1.cpp:(.text+0x1bb): undefined reference to
> `Opm::GridManager::~GridManager()'
> collect2: error: ld returned 1 exit status
> ////////////////////////////////////////////////////////////////////////////
> //
>
> The command I am using to compile is:
> g++ -std=c++11 -o test -L/home/paolo/OPM/opm-core/build/lib -lopmcore
> tutorial1.cpp
could you try with the following command?
g++ -std=c++11 -o mytest tutorial1.cpp
/home/paolo/OPM/opm-core/build/lib/libopmcore.a
then the the errors you described should go away just to be replaced by
similar ones because of missing symbols for opm-parser and for ERT and
if you fixed those, it will go on with missing boost and UMFPack
libraries. I think you see the pattern...
also note that using 'test' as a binary name is not a good idea because this
name is an internal command in many common shells.
> The header files included in tutorial1.cpp are located in
> "usr/local/include", and they are found during compilation.
> I copied config.h into the same folder of tutorial1.cpp
copying config.h is quite a hack, but as long as you stay on the same machine
as it was created on, it should work...
> Sorry, I am not really sure what you mean with "full linker command which
> 'make' tries to execute", is it the compiling command given above? Or the
> make I invoke to compile opm-core?
that's the g++ command you described above. :)
cheers
Andreas
--
Notice: "String" and "Thread" are the same thing to non-computing
people.
— Programming.com
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Opm mailing list [email protected] http://www.opm-project.org/mailman/listinfo/opm
