0

I am trying to write an application that includes both wxWidgets and OpenGL ( FreeGLUT & GLEW ). I am using CodeBlocks & C++ on a Win 7 machine. So far I have written some wxWidgets code that builds and works properly. But when I add the line :

#include "GL/freeglut.h"

The program doesn't build properly and I get these errors ( in winundef.h ) :

O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|38|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|69|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|94|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|111|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|311|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h||In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\msw\winundef.h|324|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'|

What is the reason for this problem and how to solve it ?

James C
  • 901
  • 1
  • 18
  • 38

1 Answers1

0

The solution was moving

#include "GL/glew.h"
#include "GL/freeglut.h"

after wxWidgets header files.

James C
  • 901
  • 1
  • 18
  • 38