0

I'm on a Xubuntu machine. I've downloaded and compiled the source, did the make install.

I'm trying to create a simple wxFrame class, but when I include <wx-3.0/wx/frame.h>, it says Can't resolve type wxFrame. When I look inside frame.h, it includes a reference to <wx/toplevel.h>. Both frame.h and toplevel.h are in the same folder. Why does the compilation place the include files all in the same folder, but the paths to the files are different?

I am using CLion IDE and the include/lib paths are set by cmake's FIND_PACKAGE().

ShrimpCrackers
  • 4,388
  • 17
  • 50
  • 76
  • Not sure about the specifics of your IDE but in general you might want to use wxlibs or individually include the libraries (depends on how you compiled the library). You then might want to include the include folder of wxWidgets to your include path. Also lastly you need to include the setup configuration which is under in my system lib\vc_dll\mswu and lib\vc_dll\mswud. – macroland Apr 03 '17 at 01:51
  • 1
    haven't worked on wx. But seems that you are setting include path wrong. You should set `what/ever/path/wx/installed/wx-3.0` as include path, and `#include ` instead. – Adrian Shum Apr 03 '17 at 02:10

1 Answers1

0

@ShrimpCrackers,

It is generally advisable to start you project by copying one of the sample code into you project and then set you project properties to the output of wx-config --cxxflags and wx-config --libs.

So what you should do is to copy the wxWidgets/samples/minimal/minimal.cpp over to the directory where you project is, fix the project properties and recompile.

BTW, you don't have to do make install. You might want to compile debug and release versions of the library on one machine which defeats the purpose of installing. You just use the compiled version of the library

Igor
  • 5,620
  • 11
  • 51
  • 103
  • Thanks. A few things. 1) How would I use wx-config with cmake? The following link seems to sugges wxconfig cant work with cmake. http://stackoverflow.com/questions/31092593/how-can-i-use-cmake-to-both-build-wxwidgets-on-demand-and-link-with-it 2) What lib should I be linking against? usr/local/lib has 42 .so files that start with libwx. 3) I still don't get why two (and more) header files that are in the same directory have #include paths where one of them expects to be one folder deep. For example, fileA.h and fileB.h are in same location, but fileA.h references fileB.h as wx/fileB.h. – ShrimpCrackers Apr 03 '17 at 04:24
  • @ShrimpCrackers, best suggestion - don't use CMake. ;-) 1. I am sure that the Makefile that will be generated by CMake will call wx-config with appropriate parameters. And yes - you will need to use `find_package()` call from the first answer to linked question to find and correctly parse wxWidgets libraries. 2. I unfortunately can't help you with that - you know the software better than anybody else. The minimal set is - base and core libraries. Try just that. If this will give you link errors you will know you missing a library. Then come back here and we will try to solve it. – Igor Apr 03 '17 at 16:03
  • @ShrimpCrackers, 3. I don't think this is correct. Can you reference the piece of code where you see this? Just edit the OP with that snippet. Also for 1 - use an IDE and set the project properties directly. I have Anjuta 3 which has a template to work with wxWidgets. – Igor Apr 03 '17 at 16:05