Code: Select all
Image(_T("wxpdfdoc.png"),10,8,28);
Code: Select all
Image(_T("wxpdfdoc.png"),10,8,28);
I use:BrokenBrain wrote:I'm trying the code samples that come with the library, but every sample with a row like this crash.
Any idea? I read some very old post, is it a library bug?Code: Select all
Image(_T("wxpdfdoc.png"),10,8,28);
Code: Select all
wxBitmap logo;
logo = wxBitmap(_T("wxpdfdoc.png"));
bool wxPdfDocument::Image ( const wxString & file,m_pDocument->Image( _T(""), bmp.ConvertToImage(), x, y );
It's very unlikely that it is a library bug. If the sample application crashes on adding an image this usually means that the image file has not been found. Since the file name is given without a path the image file can only be found if you run the application in the same directory where the image file resides.BrokenBrain wrote:I'm trying the code samples that come with the library, but every sample with a row like this crash.Any idea? I read some very old post, is it a library bug?Code: Select all
Image(_T("wxpdfdoc.png"),10,8,28);
This should definitely work. Which compiler do you use? And which build of wxWidgets - that is, ANSI ./. Unicode, static ./. DLL?BrokenBrain wrote:I'm using wixwidgets 2.8 and wxPdfDocument 0.8 on Windows XP.
Do you get any error messages?BrokenBrain wrote:I used the makefile to build samples and without change anything all samples with image crash. Images are in the same directory of the files and so my project, i've copyed also wxpdfdoc.png in the same directory of the exe file, but it doesn't work yet.
Good. This means either the image file is not found or for some reason the wxWidgets file system handler is not correctly initialized.BrokenBrain wrote:Examples without image work fine.
Samples with image crash on Image().
Which version of wxWidgets exactly? 2.8.7?BrokenBrain wrote:# Version of the wx library to build against.
WX_VERSION = 28
Well, when building wxWidgets you can specify a vendor tag (default: custom). But it seems your vendor tag was empty, since the link library contains a reference to 'wxmsw28u_gcc.dll'.BrokenBrain wrote:I don't image that it would can be a problem, but when i build i got this error:
"cannot find wxmsw28u_gcc.dll"
Then i rename my one "wxmsw28u_gcc_custom.dll" and i put in the same directory of the exe.
Do you think I have to rebuid to fix it?
Ok, that means, the problem can't be related to the file path. So probably for some reason the file system handler does not get initialized for some reason.BrokenBrain wrote:Rebuilding with these option all examples work fine:
# Use DLL build of wx library to use? [0,1]
WX_SHARED = 0
It should definitely work with the shared option.BrokenBrain wrote:But the exe is 30MB so the problem is for the shared option... i don't understand.
2.8.7Which version of wxWidgets exactly?
I've done:Please try out adding a call to
wxFileSystem::AddHandler(new wxLocalFSHandler);
in the OnInit method of the sample application and a call to
wxFileSystem::CleanUpHandlers();
in the OnExit method, although this should definitely not be necessary since it's done in the OnInit method of the wxFileSystemModule class on start up of a wxApp.
Code: Select all
void
tutorial2()
{
wxFileSystem::AddHandler(new wxLocalFSHandler);
//Instanciation of inherited class
PdfTuto2 pdf;
pdf.AliasNbPages();
pdf.AddPage();
pdf.Image(_T("smile.jpg"),70,40,12);
pdf.Image(_T("apple.gif"),110,40,25);
pdf.SetFont(_T("Times"),_T(""),12);
int i;
for (i = 1; i <= 40; i++)
{
pdf.Cell(0,10,wxString::Format(_T("Printing line number %d"),i),0,1);
}
pdf.SaveAsFile(_T("tutorial2.pdf"));
wxFileSystem::CleanUpHandlers();
}
I'm searching on it, when I installed wxwidgets i made a lot of tests, i used wxPack, wxdevpack, and codeblocks nightly build, maybe i forgot something. The strange thing is that it all works untill now, with ctb library, mysql library, with postresql library, but I'll see.Make sure there is no mix of different wxWidgets versions. Use of the link libraries matching the DLLs is important.
There should not be a problem using wxPdfDocument with version 2.8.7.BrokenBrain wrote:2.8.7Which version of wxWidgets exactly?
What a pity.BrokenBrain wrote: I've done:
[...]
But i've the same crash.
Usually builds of the same wxWidgets version should be binary compatible, but if slightly different configuration options were used this might not be the case.BrokenBrain wrote: I'm searching on it, when I installed wxwidgets i made a lot of tests, i used wxPack, wxdevpack, and codeblocks nightly build, maybe i forgot something. The strange thing is that it all works untill now, with ctb library, mysql library, with postresql library, but I'll see.
At the moment I can't suggest anything else than to debug the application to find out the statement/method where the crash happens. This will allow further investigation.BrokenBrain wrote: Thank you for all your suggestion,
any another il appreciated.
This is a wxWidgets issue. When you build wxWidgets a setup.h is written to a subdirectory of the wxWidgets lib directory. If wxWidgets was not build for debugging the corresponding include file will not be there.BrokenBrain wrote:I rebuilded wxwidgets.
I don't know whiy but i could not compile wxpdfdoc with debug option it says cannot find setup.h
Great.BrokenBrain wrote:Then i compiled with theese option.
[...]
and it seems to work!