skip to Main Content

I’m getting this error in the CodeLite IDE on my ubuntu OS, and I’m not sure why since I’ve done the proper #include <wx/webrequest.h>

Documents/CodeliteProjects/LearnFrench/modifyVocabFrame.cpp:75:10: error: 'wxWebRequest' was not declared in this scope

I’ve gone to the wxWebRequest sample in my wxWidgets-3.2 samples folder, and tried compiling it by using make in terminal and get these errors.

webrequest.cpp:29:2: error: #error "wxUSE_WEBREQUEST must be 1 for this sample."
   29 | #error "wxUSE_WEBREQUEST must be 1 for this sample."
      |  ^~~~~
webrequest.cpp:251:28: error: ‘wxWebRequestEvent’ has not been declared

wx-config says I have access to wxNet and all the other wxCore/Base libraries and it appears I have g++ on my system with the build-essentials, and can’t seem to find msw, and the header file is in the proper spot. Does anyone know how to resolve this error?

I tried exporting the wxUSE_WEBREQUEST=1 as an environment variable in terminal, didn’t seem to solve the make errors. Not sure if I need to pass a flag to the compiler in the makefile, or something else entirely. It seems weird the makefile wouldn’t have the proper flag set already if that’s the issue, so I’m thinking it’s something else, not quite sure what.

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problem. Turned out, the libraries from the Repo have wxWebRequest turned off by default for some reason (Or maybe I didn't have libcurl-dev at the time I installed the wx-3.2 libraries from the repos? Who knows). So I downloaded the wxWidgets Source code and compiled using ./configure, make, make install (I made sure wxUSE_WEBREQUEST=1 was in the make files before installing), and hooked up the newly created libraries in the IDE and it worked! Definitely not the answer I was looking for, but at least the source code compiled and it worked. Be nicer if the official Ubuntu repo libraries worked out of the box, but wxWidgets don't seem like they do.


  2. wxUSE_XXX preprocessor symbols are defined as 0 or 1 when building the library. Under Unix this happens when running configure script, which generates the wx/setup.h file containing these definitions. If wxUSE_WEBREQUEST is 0 in your case, it means that support for wxWebRequest is simply not present in your version of the library.

    To fix this, you need to either use the library from the system package, which should have it enabled, or build it yourself and check your config.log (not that of unrelated libtool package) created when you run configure to see whether support for it was enabled or not and why if it wasn’t.

    The most likely reason for the latter is that you don’t have libcurl-dev package (which may also be called libcurl4-dev) installed. In this case you need to install it, and then rerun configure and make to build the library with wxWebRequest support.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search