wxGLAttributes not declared

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
remigio
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Feb 11, 2021 10:54 am

wxGLAttributes not declared

Post by remigio »

Hello,

I am trying to compile a program using cmake, on Ubuntu 20.04.

When I do make, I get the following error code:

Code: Select all

/home/remi/Bureau/test_cmake/VTL/Sources/Frontend/VocalTractPicture.h:94:5: error: ‘wxGLAttributes’ has not been declared
   94 |     wxGLAttributes openGlArgs, wxWindow *updateEventReceiver);
The same program compiles without problem with Visual Studio.

I installed wxWidets and the necessary dependencies with apt-get. Shall I do something special other than installing openGL for the connexion with openGL? Or specify particular options in my CMakeLists.txt?

Here is how I link wxWidgets in CMakeLists.txt:

Code: Select all

find_package(wxWidgets REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})

add_executable(
	project
	# some files
	)
	
target_link_libraries(project 
	${wxWidgets_LIBRARIES}
	)
Thank you for your help!

Rémi
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxGLAttributes not declared

Post by PB »

I never used OpenGL and I do not know much about CMake but may be you are missing OpenGL library (gl, should be listed first with MinGW) in the list of required components here:
remigio wrote: Thu Feb 11, 2021 11:10 am

Code: Select all

find_package(wxWidgets REQUIRED COMPONENTS net core base)
However, a declaration error is a compiler error not a linker error but who knows how wxWidgets_USE_FILE is built...
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGLAttributes not declared

Post by ONEEYEMAN »

Hi,
Can you build and run any of the OpenGL samples provided by wxWidgets?

Thank you.
remigio
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Feb 11, 2021 10:54 am

Re: wxGLAttributes not declared

Post by remigio »

Hi,

thank you for your answer, and sorry for the late reply.

So I found out that I was using a different version of wxWidgets for the visual studio and unix versions of the program: wxGLAttributes is a feature of wxWidgets 3.1 and is not present in wxWidgets 3.0. I thought the latest version in the Ubuntu package I installed was 3.1, but it is 3.0.

Sorry for bothering you for nothing and thanks for your help.

Remigio
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGLAttributes not declared

Post by ONEEYEMAN »

Hi,
That is perfectly OK.
I don't know much about OpenGL, but thia is useful info for me.

Thank you.
Post Reply