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: 333
Joined: Wed Jan 20, 2010 1:15 pm

wxGraphicsContext has not been declared

Post by dkaip »

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: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB »

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: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip »

I have try with versions 3.0.5, 3.1.4 ...
Same problem.
Jim.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB »

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: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip »

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: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB »

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: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip »

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: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip »

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: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGraphicsContext has not been declared

Post by PB »

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.
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxGraphicsContext has not been declared

Post by dkaip »

Hello.
You have right for setup.h.
I think i have loose my mind.
I have delete all, making tries start all times from the beginning.
Thank you.
Jim
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGraphicsContext has not been declared

Post by ONEEYEMAN »

Hi,
Please stop using the MONOLITHIC build.
It is used very rarely and it might create problems in the long run.

Thank you.
Post Reply