Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
use Debenu PDF library with eclipse CDT plugin |
Post Reply ![]() |
Author | |
AlexA_B ![]() Beginner ![]() Joined: 08 Sep 14 Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() Posted: 08 Sep 14 at 8:58PM |
I try to create JNI wrapper around the Debenu/PDF Library/DLL/Import/CPlusPlus.
I use the CDT plugin for eclipse with MinGW for linking and compiling my code. All the examples I've found are done with WinAPI. I try very simple thing: com_mdm_mie_jniconnector_JniManager.H file: #include <jni.h> /* Header for class com_ricoh_mdm_mie_jniconnector_JniManager */ #ifndef _Included_com_mdm_mie_jniconnector_JniManager #define _Included_com_mdm_mie_jniconnector_JniManager #ifdef __cplusplus extern "C" { #endif /* * Class: com_mdm_mie_jniconnector_JniManager * Method: ping * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_mdm_mie_jniconnector_JniManager_ping (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif ================= com_mdm_mie_jniconnector_JniManager.CPP file: #include "com_ricoh_mdm_mie_jniconnector_JniManager.h" #include "DebenuPDFLibraryDLL1016.h" #include <string> #include <iostream> using namespace std; /* * Class: com_mdm_mie_jniconnector_JniManager * Method: ping * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_mdm_mie_jniconnector_JniManager_ping (JNIEnv *env, jobject obj) { //create the library and release it // Declare and load Quick PDF Library DLL std::string str = "DebenuPDFLibraryDLL1016.dll"; std::wstring temp(str.length(),L' '); std::copy(str.begin(), str.end(), temp.begin()); DebenuPDFLibraryDLL1016 QP(temp); return JNI_TRUE; } Error is: >undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)' I tried: DebenuPDFLibraryDLL1016 QP("DebenuPDFLibraryDLL1016.dll"); > no matching function for call to 'DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(const char [28])' DebenuPDFLibraryDLL1016 QP(L"DebenuPDFLibraryDLL1016.dll"); >undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)' I did not find a way to link and compile the DebenuPDFLibraryDLL1016 into my application (which is dll). Here is the command I use: g++ "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include" "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include\\win32" "-IC:\\Program Files (x86)\\Debenu\\PDF Library\\DLL\\Import\\CPlusPlus" -O0 -g3 -Wall -c -fmessage-length=0 -o com_mdm_mie_jniconnector_JniManager.o "..\\com_mdm_mie_jniconnector_JniManager.cpp" g++ -shared -o libwinwrapper.dll com_mdm_mie_jniconnector_JniManager.o For now it seems I can not create the const std::wstring as it is declared by the constractor: DebenuPDFLibraryDLL1016(const std::wstring& dllFileName); Please help. |
|
![]() |
|
AlexA_B ![]() Beginner ![]() Joined: 08 Sep 14 Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
I tried the following:
std::wstring lib; lib.append(L"DebenuPDFLibraryDLL1016.dll"); DebenuPDFLibraryDLL1016 QP(lib); still no luck: >> C:\Tmp\Osgi\winwrapper\Debug/../com_mdm_mie_jniconnector_JniManager.cpp:37: undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)' C:\Tmp\Osgi\winwrapper\Debug/../com_mdm_mie_jniconnector_JniManager.cpp:37: undefined reference to `DebenuPDFLibraryDLL1016::~DebenuPDFLibraryDLL1016()' collect2.exe: error: ld returned 1 exit status |
|
![]() |
|
AlexA_B ![]() Beginner ![]() Joined: 08 Sep 14 Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
I believe that the problem is linking the dll's into my project.
Here's the steps I did: 1. copied C:\Program Files (x86)\Debenu\PDF Library\DLL into C:\Debenu directory, so the path does not have any white spaces. 2. created the following link command: g++ "-LC:\\Debenu\\DLL" -shared -o libwinwrapper.dll com_ricoh_mdm_mie_jniconnector_JniManager.o -lDebenuPDFLibraryDLL1016 I did it according to the following page: Unfortunately it still does not work. I got the following error: C:\Tmp\Osgi\winwrapper\Debug/../com_mdm_mie_jniconnector_JniManager.cpp:37: undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)' C:\Tmp\Osgi\winwrapper\Debug/../com_ricoh_mdm_mie_jniconnector_JniManager.cpp:37: undefined reference to `DebenuPDFLibraryDLL1016::~DebenuPDFLibraryDLL1016()' collect2.exe: error: ld returned 1 exit status Can I find the setting for the C++ debenu dll libraries ? Should I include both: DebenuPDFLibrary64DLL1016 and DebenuPDFLibraryDLL1016 with "-l" option ? Should I include the directory "-L" option ? |
|
![]() |
|
AlexA_B ![]() Beginner ![]() Joined: 08 Sep 14 Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
Found my problem.
Add the * DebenuPDFLibraryDLL1016.cpp * DebenuPDFLibraryDLL1016.h into your project. Do not just include them in the compiler , but physically copy them in the same dirsctory. PS: during compilation it gives hundreds of warnings: "warning: deprecated conversion from string constant to ‘char*’"you will have to add the following option to compiler to suppress them all:-Wno-write-strings
Regards |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store