wxGraphicsContext has not been declared

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 263
Joined: Wed Jan 20, 2010 1:15 pm

wxGraphicsContext has not been declared

Post by dkaip » Tue Oct 13, 2020 8:55 pm

Hello.
I have build the GUItest from scratch with CodeBlocks 20 in Win10. Runs ok.
I have download wxPDFView source files from Github, ok.
I have add wxPDFView files in my test project.
PDFView.h
PDFViewArtProvider.h
PDFViewBookmarksCtrl.h
PDFViewDocumentFrame.h
PDFViewDocumentPanel.h
PDFViewThumbnailListBox.h
PDFView.cpp
PDFViewActivityPanel.cpp
PDFViewArtProvider.cpp
PDFViewBookmarks.cpp
PDFViewBookmarksCtrl.cpp
PDFViewDocumentFrame.cpp
PDFViewDocumentPanel.cpp
PDFViewImpl.cpp
PDFViewPages.cpp
PDFViewPrintout.cpp
PDFViewTextRange.cpp
PDFViewThumbnailListBox.cpp
PDFViewThumbnailListBoxImpl.cpp
Compiling GCC says ...
..\wxPDFView\include\private\PDFViewPages.h|42|error: 'wxGraphicsContext' has not been declared|
Why is that? wxGraphicsContext belongs to wxCore lib and in project there is the libwxmsw30ud_core.a lib.
Here the libs ..
<Linker>
<Add library="libwxmsw30ud_richtext.a" />
<Add library="libwxmsw30ud_xrc.a" />
<Add library="libwxmsw30ud_aui.a" />
<Add library="libwxmsw30ud_media.a" />
<Add library="libwxbase30ud_net.a" />
<Add library="libwxmsw30ud_gl.a" />
<Add library="libwxbase30ud_xml.a" />
<Add library="libwxmsw30ud_adv.a" />
<Add library="libwxmsw30ud_html.a" />
<Add library="libwxmsw30ud_core.a" />
<Add library="libwxbase30ud.a" />
<Add library="libwxpngd.a" />
<Add library="libwxjpegd.a" />
<Add library="libwxtiffd.a" />
<Add library="libwxzlibd.a" />
<Add library="libwxregexud.a" />
<Add library="libwxexpatd.a" />
<Add directory="C:/wxWidgets/lib/gcc_lib" />
</Linker>
Than you
Jim.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2547
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB » Wed Oct 14, 2020 5:58 am

AFAIK, declaration error is a compiler error, not a linker one.

That would mean there is an include or forward declaration missing somewhere.

However, I am not sure if wxWidgets 3.0 support wxGC with MinGW, I would check if wxUSE_GRAPHICS_CONTEXT is defined to 1.

EDIT
Unlike wxWidgets 3.1.4, wxWidgets 3.0.5.1 support wxGC out of the box only with MSVC, see https://github.com/wxWidgets/wxWidgets/ ... up0.h#L783

dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 263
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip » Wed Oct 14, 2020 11:06 am

I have try with versions 3.0.5, 3.1.4 ...
Same problem.
Jim.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2547
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB » Wed Oct 14, 2020 2:15 pm

I am not familiar with wxPDFium: does it even support MinGW on MS Windows? FWIW, AFAIK similar Chromium does not.

Are you really using wxWidgets 3.1.4: In another thread you claimed to use the git master (= v3.1.5) but based on their names the libraries you built were actually for 3.0?

Is wxUSE_GRAPHICS_CONTEXT preset to 1 when building your application?

dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 263
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip » Wed Oct 14, 2020 6:17 pm

Hello.
I build all versions and many times.
To know exactly what i will use in my projects.
I will try wxUSE_GRAPHICS_CONTEXT=1 to see what will happen.
Thank you
Jim

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2547
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB » Wed Oct 14, 2020 6:21 pm

dkaip wrote:
Wed Oct 14, 2020 6:17 pm
I will try wxUSE_GRAPHICS_CONTEXT=1 to see what will happen.
Just to make sure we are on the same page: If you are using wxWidgets 3.1.4, it should be set to 1. If you are using wxWidgets 3.0.x, you need to set in the master setup.h, do a clean rebuild of wxWidgets and hope it builds.

Either way, you can test its value easily in the code in your test app.

BTW, have you used wxPDFView with MinGW before?

dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 263
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip » Wed Oct 14, 2020 7:18 pm

Yes I have made wxPDFView library using cmake I have made codeblocks project file with Mingw64(CodeBlocks20) and then running it build the libwxPDFView.a library.
But I can't know how to use it.
I will try all wxXidgets versions and publish the results with icons.
I don't know if in this subject fit these things.
have you used wxPDFView with MinGW before?
No, this must try, as i see there is no much help on this, and is so important...
Thank you
Jim.

dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 263
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip » Thu Oct 15, 2020 8:41 am

Hello. Problem solved.
With wxWidgets-3.1.4 build as...
mingw32-make -f makefile.gcc LDFLAGS="-static" BUILD=debug SHELL=cmd.exe
mingw32-make -f makefile.gcc LDFLAGS="-static" BUILD=debug MONOLITHIC=1 SHELL=cmd.exe
mingw32-make -f makefile.gcc LDFLAGS="-static" BUILD=release SHELL=cmd.exe
mingw32-make -f makefile.gcc LDFLAGS="-static" BUILD=release MONOLITHIC=1 SHELL=cmd.exe
Just fine.
Thank you
Jim

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2547
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB » Thu Oct 15, 2020 9:21 am

I think this is wrong.

Not only are you building the library twice for each conifiguration (Debug and Release), firstly as multilib and then as monolithic; you are having both multilib and monolithic build in the same folder (which also means overwriting the build-specific setup.h).

This makes little sense to me. If you for some odd reason need both multilib and monolithic (why even having monolithic STATIC build?), you should keep them in separate folders, e.g. using CFG build parameter.

Post Reply