I am trying to compile the CTranslate example provided in the documentation, but it’s raising the following error. Any suggestion? sample.cpp:3:23: fatal error: onmt/onmt.h: No such file or directory
The sample.cc files looks like this: #include
#include <onmt/onmt.h>
int main()
{
// Create a new Translator object.
auto translator = onmt::TranslatorFactory::build("…/model_checkpoint.t7");
// Translate a tokenized sentence.
std::cout << translator->translate(“你好,世界!”) << std::endl;
This example is for using the library so you have to put all the include paths in the compile command with the -I option (or better transfer them to your system’s include directory) and also link to the library. Sth like this:
Thanks for the support. With those changes, compilation is smoothly compiling, but I have an errror while running the executable file. Here is the error: ./sample: error while loading shared libraries: libonmt.so: cannot open shared object file: No such file or directory.
But why not use the command line tool? If you indeed want to use the library in your own application, an IDE or a cmake project would be so much easier.