Compiling failed
Closed this issue · 6 comments
I created a new project with Code::Blocks on a Rasperry Pi 3 and wanted to use your library now. First I built the library with cmake. Then I added the include files to the compiler settings and the built libpocket-tensor.a file to the linker settings. If I now build your example code, I get the following error message:
g++ -Wall -fexceptions -g -I../pocket-tensor/3rd_party/libsimdpp -I../pocket-tensor/lib/include -c /home/pi/behrens_ki/main.cpp -o obj/Debug/main.o
g++ -o bin/Debug/behrens_ki obj/Debug/main.o -lpthread ../pocket-tensor/build/lib/libpocket-tensor.a
/.../main.cpp: In function ‘int main()’:
/.../main.cpp:8:18: error: ‘create’ is not a member of ‘pt’
Are the steps I took right, or did I miss something?
Hi!
Code::Blocks does not support CMake projects, but CMake can generate Code::Blocks projects.
For example, if you want to build and run pocket-tensor tests from Code::Blocks, you have to do the following:
python make_tests.py
mkdir tests_build
cd tests_build
cmake -DPT_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -G"CodeBlocks - Unix Makefiles" ..
These commands will generate a *.cbp Code::Blocks project file on test_build
folder.
My problem is not building the library, but integrating the built library into my project. I'm not very experienced in including third party libraries. Of course I can simply copy all headers and source files into my project, but that's not pretty. I want to link the library in my project. Therefore I entered the search path of the include files in the project and the built library file *.a. But that's not gonna work. I get the error mentioned above.
Could you show me your main.cpp
file?
It's the code from your example.
#include <iostream>
#include "pt_model.h"
#include "pt_tensor.h"
int main()
{
// Initialize model:
auto model = pt::create("example.model");
// REQUIRE(model);
// Create input tensor:
pt::Tensor in(10);
in.setData({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
// Run prediction:
pt::Tensor out;
bool success = model->predict(std::move(in), out);
// REQUIRE(success);
// Print output:
std::cout << out << std::endl;
return 0;
}
The example code is wrong! u_u
You should put auto model = pt::Model::create("example.model");
Ill fix it ASAP.
Thank you for the issue, BTW.
I could have come up with that myself ;D.
Thank you very much for your help!