wxPDFDocument compiling  [SOLVED]

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
DerKleineNik
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Sep 09, 2011 9:59 am

wxPDFDocument compiling

Postby DerKleineNik » Fri Sep 09, 2011 12:24 pm

First the environment: MinGW, wxWidgets-2.8.11, wxPDFDocument 0.9.2, Codelite v 3.0.5041

I'm trying to install(compile) the wxPDFDocument by using the makefile.gcc but i get the following error:

C:\Programme\wxPDFDocument\build>mingw32-make -f makefile.gcc
if not exist ..\lib\gcc_dll mkdir ..\lib\gcc_dll
g++ -c -o gccmswud\pdfdoc_dll_pdfxml.o -DHAVE_W32API_H -DWXUSINGDLL -D_UNICODE -
D__WXDEBUG__ -D__WXMSW__ -IC:\Programme\wxWidgets-2.8.11\lib\gcc_dll\mswud -IC:\
Programme\wxWidgets-2.8.11\include -O0 -g -W -Wall -I..\include -DWXMAKINGDLL_PD
FDOC -MTgccmswud\pdfdoc_dll_pdfxml.o -MFgccmswud\pdfdoc_dll_pdfxml.o.d -MD -MP
../src/pdfxml.cpp
../src/pdfxml.cpp: In member function 'void wxPdfDocument::PrepareXmlCell(wxXmlN
ode*, wxPdfCellContext&)':
../src/pdfxml.cpp:1082:93: error: operands to ?: have different types 'const wxC
har*' and 'wxString'
../src/pdfxml.cpp: In member function 'void wxPdfDocument::WriteXmlCell(wxXmlNod
e*, wxPdfCellContext&)':
../src/pdfxml.cpp:1749:93: error: operands to ?: have different types 'const wxC
har*' and 'wxString'
mingw32-make: *** [gccmswud\pdfdoc_dll_pdfxml.o] Error 1


Before compiling I first configured the makefile to my environment and set the WXWIN to my wxWidgets path as recommended.

I've tried to find that problem in the source code but I couldn't find the function "wxGetTranslation" so I can't figure out what exactly the problem ist.

Regards, Nik

edit: tried now the version 0.9.1.2 and everything worked well, i guess that this is a bug that occurs with several compiler settings

utelle
Moderator
Moderator
Posts: 830
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPDFDocument compiling

Postby utelle » Fri Sep 09, 2011 8:35 pm

DerKleineNik wrote:First the environment: MinGW, wxWidgets-2.8.11, wxPDFDocument 0.9.2, Codelite v 3.0.5041

I'm trying to install(compile) the wxPDFDocument by using the makefile.gcc but i get the following error:

C:\Programme\wxPDFDocument\build>mingw32-make -f makefile.gcc
if not exist ..\lib\gcc_dll mkdir ..\lib\gcc_dll
g++ -c -o gccmswud\pdfdoc_dll_pdfxml.o -DHAVE_W32API_H -DWXUSINGDLL -D_UNICODE -
D__WXDEBUG__ -D__WXMSW__ -IC:\Programme\wxWidgets-2.8.11\lib\gcc_dll\mswud -IC:\
Programme\wxWidgets-2.8.11\include -O0 -g -W -Wall -I..\include -DWXMAKINGDLL_PD
FDOC -MTgccmswud\pdfdoc_dll_pdfxml.o -MFgccmswud\pdfdoc_dll_pdfxml.o.d -MD -MP
../src/pdfxml.cpp
../src/pdfxml.cpp: In member function 'void wxPdfDocument::PrepareXmlCell(wxXmlN
ode*, wxPdfCellContext&)':
../src/pdfxml.cpp:1082:93: error: operands to ?: have different types 'const wxC
har*' and 'wxString'
../src/pdfxml.cpp: In member function 'void wxPdfDocument::WriteXmlCell(wxXmlNod
e*, wxPdfCellContext&)':
../src/pdfxml.cpp:1749:93: error: operands to ?: have different types 'const wxC
har*' and 'wxString'
mingw32-make: *** [gccmswud\pdfdoc_dll_pdfxml.o] Error 1


Before compiling I first configured the makefile to my environment and set the WXWIN to my wxWidgets path as recommended.

The problem is that the wxWidgets function wxGetTranslation returns wxChar* (for wxWidgets 2.8.x) while GetNodeContent returns wxString. I missed this issue since the compiler Visual C++ 2008 which I use for most of my development didn't issue an error message and not even a warning. And the problem didn't surface during my testing on Linux with gcc and wxWidgets 2.9.2 since function wxGetTranslation returns wxString for wxWidgets 2.9.x.

Fixing the problem is easy: just write wxString(wxGetTranslation(...)) at both places where wxGetTranslation is called..

DerKleineNik wrote:I've tried to find that problem in the source code but I couldn't find the function "wxGetTranslation" so I can't figure out what exactly the problem ist.

Well, wxGetTranslation is a wxWidgets function (documented here http://docs.wxwidgets.org/stable/wx_stringfunctions.html#wxgettranslation.

DerKleineNik wrote:edit: tried now the version 0.9.1.2 and everything worked well, i guess that this is a bug that occurs with several compiler settings

No wonder that wxPdfDocument 0.9.1.2 compiles without problems - in that version wxGetTranslation is not used.

Although the problem surfaces only for wxWidgets 2.8.x in combination with gcc (and maybe only specific versions of gcc) I'm going to change the code in file pdfxml.cpp to avoid this issue.

Regards,

Ulrich

DerKleineNik
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Sep 09, 2011 9:59 am

Re: wxPDFDocument compiling

Postby DerKleineNik » Sat Sep 10, 2011 10:05 am

Thanks for your reply!
I also had the idea with the typecast but the advisor in my project didn't want to start with such "hacking" in external sourcecode.
Well if should need the newer version i know now how to fix it.
Tank you very much!

utelle
Moderator
Moderator
Posts: 830
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPDFDocument compiling  [SOLVED]

Postby utelle » Sat Sep 10, 2011 12:38 pm

DerKleineNik wrote:I also had the idea with the typecast but the advisor in my project didn't want to start with such "hacking" in external sourcecode.
Well if should need the newer version i know now how to fix it.

I applied a bug fix to the wxCode SVN. You may download an "official" version of the modified source code from there: pdfxml.cpp. You should definitely use the latest version 0.9.2 since it fixes several bugs and provides an improved wxPdfDC class. And probably I'll make a new file release as version 0.9.2.1 within the next few days.

Regards,

Ulrich


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 6 guests