I'm trying to use the latest version of PicklingTools ( http://www.picklingtools.com/ ) with QT Creator. I just want to open a pickled sample file that I downloaded together with the PicklingTools files. So my main.cpp file looks very basic:
#include <iostream>
#include "chooseser.h"
using namespace std;
int main()
{
Val result;
LoadValFromFile("../PicklingTools163Release/C++/SamplePickles/p7.pkl",result,SERIALIZE_P0);
return 0;
}
I edited the .pro file in the following way:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp \
INCLUDEPATH += ../PicklingTools163Release/C++/
INCLUDEPATH += ../PicklingTools163Release/C++/opencontainers_1_8_4/include/
LIBS += -pthread
HEADERS += \
../PicklingTools163Release/C++/chooseser.h \
QMAKE_CXXFLAGS += -std=c++0x -pthread
QMAKE_CXXFLAGS += -fno-strict-aliasing -DLINUX_ -DOC_NEW_STYLE_INCLUDES -Wno-deprecated -I../PicklingTools163Release/C++/opencontainers_1_8_4/include -I../PicklingTools163Release/C++ -pthread -D_REENTRANT
At the moment I receive multiple undefined reference errors:
- Fehler: undefined reference to `OC::CopyPrintableBufferToVector(char const*, unsigned long, char*, unsigned long)'
- Fehler: undefined reference to `OC::P2TopLevelLoadVal(OC::Val&, char*)'
- Fehler: undefined reference to `OC::OpalLoadSomeTable(OC::Val&, char*, bool, OC::MachineRep_e)'
- Fehler: undefined reference to `OC::CopyPrintableBufferToVector(char const*, unsigned long, char*, unsigned long)'
- Fehler: undefined reference to `OC::MakeVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, char const*, unsigned long)'
I guess that I need to edit the .pro
file further but right now I have no idea how to do that.
The OpenContainers code works as INCLUDE ONLY, ie, you don't have to link against anything to use JUST the OpenContainers code (OC::Val, OC::Tab, etc.). BUT!
To use any of the Pickling code (like the undefined entries you see for P2TopLevelLoadVal
, MakeVector
, etc.) you need to build and link against the ptools library. That library contains all the Python pickling code.
% cd /home/me/PicklingTools163Release/C++
% make -f Makefile.Linux libptools.so
# .... builds a lot of files, and put them into libptools.so ....
# Update your Makefile to link against libptools.so
Hope that helps. Link against libptools.so
in your Makefile.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.