Author Topic: missing wx/setup.h  (Read 7245 times)

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
missing wx/setup.h
« on: December 10, 2022, 10:43:54 pm »
codeblocks 20.3 has choices for versions of wxWidgets 2.6, 2.8, 3.0, 3.1  . I've recently installed version 3.2.1

I am getting an error when compiling - can't find wx\setup.h   I've found solutions for earlier versions of codeblocks/wx, but nothing more recent than about 2014, iirc, and they seem to not work.

Is there a detailed installation guide for installing wx, and simple beginner's setup/usage, I've not found anything recent? Am I right in thinking that I need to install a copy of wxWidgets that matches one listed in the codeblocks ide?

Quote
R:\wxWidgets-3.2.1\include\wx\platform.h|159|fatal error: wx/setup.h: No such file or directory|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===|

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: missing wx/setup.h
« Reply #1 on: December 11, 2022, 12:35:30 am »
Am I right in thinking that I need to install a copy of wxWidgets that matches one listed in the codeblocks ide?

No, unless you wish to build Code::Blocks (CB) or CB Plugins the version does not need to match.

The wxWidgets library does almost always need to be built with the Compiler you are going to use.

Link to offsite directions https://forums.wxwidgets.org/viewtopic.php?f=19&t=47233

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #2 on: December 11, 2022, 01:09:26 pm »
Thanks for the link. At first glance it looks a bit more complicated than 'install and run'. I'll see how it goes. At least it seems to be pretty much up to date.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #3 on: December 11, 2022, 03:39:30 pm »
Are you using the built-in wxWidgets project template wizard? The one shipped with C::B v20.03 does not support wxWidgets v3.2.

You need to use the wizard bundled with the C::B nightly build or the one I provide with my guide.

Anyway, adding wxWidgets to a project is really simple and no different from any other compiled library. The only difference is that one needs to add two include paths (build-specific and general), but this is well-documented.
« Last Edit: December 11, 2022, 03:53:49 pm by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #4 on: December 12, 2022, 03:44:35 pm »
Are you using the built-in wxWidgets project template wizard? The one shipped with C::B v20.03 does not support wxWidgets v3.2.

You need to use the wizard bundled with the C::B nightly build or the one I provide with my guide.

Anyway, adding wxWidgets to a project is really simple and no different from any other compiled library. The only difference is that one needs to add two include paths (build-specific and general), but this is well-documented.

Are you suggesting that I am more likely to succeed if I get a recent nightly builds, of codeblocks, (any one, or the most recent?)  and there is an included  wizard that will install wxWidgetsi.  I read through parts of your guide, which appears to be comprehensive, but in all honesty, I've little idea on how to proceed, at the moment. There seems to be too many choices for me, in particular when I have little idea of exactly what I now have on my system. Am I right in thinking that none of this needs to be installed on drive C:, provided i put in the full path name when asked in the installation procedures?

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #5 on: December 12, 2022, 04:24:48 pm »
Are you suggesting that I am more likely to succeed if I get a recent nightly builds, of codeblocks, (any one, or the most recent?)  and there is an included  wizard that will install wxWidgetsi. 

AFAIK, there is no C::B wizard that is going to install wxWidgets for you. The wizard I mentioned just creates a C::B project using wxWidgets, but a wxWidgets build must be available.

I've little idea on how to proceed, at the moment. There seems to be too many choices for me, in particular when I have little idea of exactly what I now have on my system.
Building wxWidgets is no rocket science, all you need is:
1. Decide on which compiler to use and ensure it is installed and set-up in C::B.
2. Decide which wxWidgets version to use - I agree with your choice of v3.2.1.
3. Build wxWidgets in your desired configuration (e.g., shared vs static, 32- or 64-bit).
4. Create a C::B project using wxWidgets, either with the wizard from the nightly or my guide.

Am I right in thinking that none of this needs to be installed on drive C:, provided i put in the full path name when asked in the installation procedures?

wxWidgets certainly can be anywhere, I am not sure about the compiler. I am also not sure what you mean by the installation procedure. I would just download wxWidgets source archive and build it as described in the official docs or in my guide. Unless you have a very slow compiler, the build should take minutes or tens of minutes at most.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #6 on: December 12, 2022, 05:51:00 pm »
Thanks, it's getting a bit clearer, I'll let you know how I get on.
I expect it will be the gnu gcc compiler, version 3.21 of wxWidgets and static 64 build. It seems that wxSmith is fairly straightforward. The only bit I think I've not done before, afaik,  is build wxWidgets.. I'l'l remove the existing and do a fresh install of it all.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #7 on: December 12, 2022, 08:39:02 pm »
Hi ,
Going through your comprehensive PB guide, I'm stuck. It seems that the page you linked to Para 3.2, , my w10 complains about the fileo says it's unconfirmed, but I tried another page, and got msys2 installed, it needed no updates. The links to mingw toolchain, no longer seems to exist in para 3.3 . Of course, it could be me, I tried msys2 a week or two back, got nowhere with it. I guess your para 3.4 will be the way to go.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: missing wx/setup.h
« Reply #8 on: December 12, 2022, 09:46:19 pm »
I have never installed msys2 and it needed no updates; you are either lucky or wrong.

Command to update msys2 below
Code
pacman -Syuu

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #9 on: December 12, 2022, 09:57:36 pm »
At least, afasi can tell, I've got wxwin environment variable set up, but then got stuck in trying to do a staticbuild of wx widgets, using your build-library-static.bat. So, as I think you mentioned to use a nightly build of codeblocks,, I thought I 'd try that but it says on that page

Quote
Before you use a nightly make sure you understand how it works.

A link to the unicode windows wxWidget dll(s) for Code::Blocks : https://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/Prerequisites/wxmsw32u_gcc_cb_wx321_2D_gcc810-mingw64.7z
A link to Mingw64 dll's needed by Code::Blocks : http://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/Prerequisites/Mingw64dlls8.1.0.7z


The 10 December 2022 build is out.
  - Windows :
   http://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/2022/CB_20221210_rev13107_win64.7z
  I have no idea on how to install that, so is there an 'idiot's guide' somewhere?
If I install the 20.03 release, that has a setup, is that the way, then install the nightly?

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #10 on: December 12, 2022, 10:02:55 pm »
Hi ,
Going through your comprehensive PB guide, I'm stuck. It seems that the page you linked to Para 3.2, , my w10 complains about the fileo says it's unconfirmed, but I tried another page, and got msys2 installed, it needed no updates.

You should have downloaded and run file msys2-x86_64-20221028.exe. Did you?

The links to mingw toolchain, no longer seems to exist in para 3.3 . Of course, it could be me, I tried msys2 a week or two back, got nowhere with it. I guess your para 3.4 will be the way to go.

There are only two links in Chapter 3.3: https://packages.msys2.org/group/mingw-w64-x86_64-toolchain and https://www.msys2.org/docs/environments/#msvcrt-vs-ucrt and they are both working.

More importantly, they are not really needed for installing the compiler or installing wxWidgets, they only provide an optional information.

If you do not install the compiler package properly, you will not be able to continue with building wxWidgets or your application. This means you should start MSYS2 environment, run
Code
pacman -S mingw-w64-x86_64-toolchain
and press Enter when asked about installation.

But as I write in the guide, using MSYS2 is not mandatory, any compatible recent(-ish) mingw-64-based GCC distribution should work.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #11 on: December 12, 2022, 10:05:15 pm »
At least, afasi can tell, I've got wxwin environment variable set up, but then got stuck in trying to do a staticbuild of wx widgets, using your build-library-static.bat. So, as I think you mentioned to use a nightly build of codeblocks,, I thought I 'd try that but it says on that page
ll the 20.03 release, that has a setup, is that the way, then install the nightly?

Code::Blocks version and building wxWidgets are utterly unrelated, i.e., C::B version cannot in any way affect wxWidgets build. If you have a build error, you need to take a look at the error message.

You can also just use C::B v20.03 with my updated wizard from the guide GitHub repo, it even has a nice batch file to install it for the current C::B version.

But you seem to have an unusually high number of issues with such a simple task as building wxWidgets on Windows. All you need for it is to have a working compiler, extracted wxWidgets archive, and WXWIN set?
« Last Edit: December 12, 2022, 10:07:53 pm by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #12 on: December 13, 2022, 01:15:33 pm »
Hope I'm not trying your patience too much, I appreciate your help. I think I had internet problems yesterday, Today I had a raft of emails from my bank, going back to 17th Nov, and a registration code for git hub, that expired yesterday.

Anyway, I've reinstalled msys2, (and updated it) and have managed everything up to and including fig 3.1. 

I've now confused myself with choices and decisions. The basic requirement is that I want to use codeblocks and a gui design method of generating windows forms, etc., for which I need wxwidgets

I've got to where I've installed the mingw packages, at para 3.3 . Has that built wx widgets, or do I then carry on through to para 3.6.8 and then install codeblocks etc, and do all of section 4, or once wx widgets is built in section 3, I can use that build by just installing code blocks?  I need baby steps, but in the right order.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #13 on: December 13, 2022, 02:19:48 pm »
First, you do not need wxWidgets to create a GUI application for Windows, there are several other choices even for just C++.

Secondly, I hope that by "windows forms" you do not mean Microsoft's Windows Forms, which are available only for .NET.

Thirdly, if you are not sure how to proceed: Why not just follow the guide, including the order in which the individual steps are done? The guide is intended to be followed step by step (with the purpose of each step explained) and if you miss a step, you will not be able to finish it.

Lastly, for building wxWidgets, I would use a parallel build (e.g., with build-library-static-parallel.bat): If you have a computer suited for C++ development, it should speed-up the build considerably. You can tune the number of processors (the number after -j) for your computer, e.g., change the default -j4 to -j2 if your computer has only four cores, so you can still use the computer during the build. But this is also mentioned in the guide...

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #14 on: December 13, 2022, 04:49:38 pm »
Not microsoft windows forms, but those as mentioned under wxSmith. For me, your guide goes into too much detail, It takes me a while to even understand the terminology, and if I do, then next week it will be forgotten. Not your problem, of course, but I'm more familiar with simpler installation procedures. Anyway, we live and learn.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #15 on: December 13, 2022, 09:03:20 pm »
I am not saying my guide is perfect (and it is overly detailed if all one is looking for is to copy&paste a build command line) but I am unaware of introducing any terminology that should be new to a beginner-level C++ programmer who is also a MS Windows user.

I also believe that reading the guide is not something that should be split in weeks. Reading it, installing a compiler, downloading and building wxWidgets, and finally having a template C::B project running should not take more than an hour (assuming a decent internet connection and PC configuration).
« Last Edit: December 13, 2022, 09:54:23 pm by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #16 on: December 14, 2022, 06:35:37 pm »
The problem is now with basic  build commands  (your listing 3.1).
I am not putting this on drive c:, but on drive r. 'I modified your batch file commands, and entered them one by one. My wxwin path is set correctly , but there is something a bit adrift. I've put below a listing of the cmd  lines, and replies. I found I had to put in the full path names, but it does not recognize the 'makefile.gcc',, but it copied one file OK. Although iIhave used makefiles before, I've never actually looked into them, but if they simply move existing files to another directory, then if it is not found, then maybe I could do it manually. Anyway, here is a copy of the command line (shift delete and pasted into notepad.)

Quote
C:\Users\Ray>cd /d %WXWIN%\build\MSW

R:\wxWidgets-3.2.1\build\msw>mingw32-make -f makefile.gcc SHARED=1 BUILD=debug SHELL=cmd.exe
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.

R:\wxWidgets-3.2.1\build\msw>R:\msys64\mingw64\bin\mingw32-make -f makefile.gcc SHARED=1 BUILD=release SHELL=cmd.exe
if not exist gcc_mswudll mkdir gcc_mswudll
if not exist ..\..\lib\gcc_dll mkdir ..\..\lib\gcc_dll
if not exist ..\..\lib\gcc_dll\mswu mkdir ..\..\lib\gcc_dll\mswu
if not exist ..\..\lib\gcc_dll\mswu\wx mkdir ..\..\lib\gcc_dll\mswu\wx
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
        1 file(s) copied.
if not exist ..\..\lib\gcc_dll\mswu\wx\msw mkdir ..\..\lib\gcc_dll\mswu\wx\msw
gcc -E  "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\gcc_dll\mswu\wx\msw\rcdefs.h"
'gcc' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make: *** [makefile.gcc:5987: ..\..\lib\gcc_dll\mswu\wx\msw\rcdefs.h] Error 1

R:\wxWidgets-3.2.1\build\msw>R:\msys64\mingw64\bin\mingw32-make -f R:\wxWidgets-3.2.1\build\msw\makefile.gcc SHARED=1 BUILD=release SHELL=cmd.exe
gcc -c -o gcc_mswudll\wxregex_pcre2_auto_possess.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_auto_possess.o -MFgcc_mswudll\wxregex_pcre2_auto_possess.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_auto_possess.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make: *** [R:\wxWidgets-3.2.1\build\msw\makefile.gcc:6032: gcc_mswudll\wxregex_pcre2_auto_possess.o] Error 1

R:\wxWidgets-3.2.1\build\msw>
R:\wxWidgets-3.2.1\build\msw>set wxwin
WXWIN=R:\wxWidgets-3.2.1


There are numerous makefile.gcc, so hopefully I've got the right one, and have not made a typo.

If it is something within the make files, that perhaps expects to be built on drive c, not any drive, then I will have to most likely find space on c.  (both are relatively small ssd's)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: missing wx/setup.h
« Reply #17 on: December 14, 2022, 06:50:50 pm »
You should, at least add R:\msys64\mingw64\bin to your PATH system variable.
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #18 on: December 14, 2022, 08:07:58 pm »
You should, at least add R:\msys64\mingw64\bin to your PATH system variable.
Which is, of course, described in my guide and done in the provided build batch files.

However, I am not sure if the OP installed MSYS2 to R: drive as well.
« Last Edit: December 14, 2022, 08:13:13 pm by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #19 on: December 14, 2022, 11:21:36 pm »
mysys2.exe is in R:\mysys64.  I was pretty sure I set the path, but just done it again, with same result.
Quote
R:\wxWidgets-3.2.1\build\msw>set path=r:\mysys64\mingw64\bin%path%

R:\wxWidgets-3.2.1\build\msw>
R:\wxWidgets-3.2.1\build\msw>R:\msys64\mingw64\bin\mingw32-make -f R:\wxWidgets-3.2.1\build\msw\makefile.gcc SHARED=1 BUILD=release SHELL=cmd.exe
gcc -c -o gcc_mswudll\wxregex_pcre2_auto_possess.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_auto_possess.o -MFgcc_mswudll\wxregex_pcre2_auto_possess.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_auto_possess.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.

In my previous post, it did seem to work for one file copy. The mingw32-make.exe is in the >R:\msys64\mingw64\bin directory, and also an empty file named mingw32-make  (no .exe extension) Not sure what that means. Is there code in the makes that have the drive letters predefined? I have the folder R:\wxWidgets-3.2.1\lib\gcc_dll  with only the mswu folder, and a couple of virtually empty folders within that mswu. I've had this 'copy one file only in the make' situation before.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #20 on: December 15, 2022, 07:36:05 am »
mysys2.exe is in R:\mysys64.  I was pretty sure I set the path, but just done it again, with same result.
Quote
R:\wxWidgets-3.2.1\build\msw>set path=r:\mysys64\mingw64\bin%path%
Are you sure your default PATH starts with a semicolon? If not, then the command above does NOT set the correct path to GCC (i.e., you are missing a semicolon between "bin" and "%path%").

Why not just use tested working commands available, modified for your path? In other words, do not retype the commands you think are correct, copy and paste them, adjust the path, check they are correct and then run them.

There is no reason to use full path to the make executable or the makefile itself.

Lastly, read the error messages and try to understand them. By doing this, you will have a chance to figure the problem by yourself.

For example, in one of your previous posts, the system told you "'mingw32-make' is not recognized as an internal or external command" yet you assumed there is an issue with a makefile. In your last post, it is clear that the issue not just with GCC but also with make since you had to use a full path; this means that you did not set PATH correctly.

BTW, all issues so far have nothing to do with wxWidgets, Code::Blocks, or my guide; it's just the most basic C++ / Windows knowledge.
« Last Edit: December 15, 2022, 07:47:06 am by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #21 on: December 15, 2022, 12:19:07 pm »
Well spotted wrt the semi-colon. I think I mentioned earlier that it may be a typo. I did not want to mess with your batch files. Anyway, I have now run your build -library-shared.bat, however i was disappointed that after possibly an hour of build, it merely finished. I would have expected a rendition of the National Anthem, and setting off of fireworks! (Misleadingly, that window closed, leaving my previous one with the error messages showing...)
All the files appear to be present in gcc-dll folder, I will run your minimal sample test.
I want to install the static build version, if that can coexist with the debug/release versions. Do I just delete the two folders you mention  in cleaning the gcc builds, and run the static build batch file?


Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: missing wx/setup.h
« Reply #22 on: December 15, 2022, 12:29:10 pm »
Anyway, I have now run your build -library-shared.bat, however i was disappointed that after possibly an hour of build, it merely finished.
Had you followed the advice I gave in the guide and even repeated here (i.e., use the parallel build), it should have taken much less time.

Misleadingly, that window closed, leaving my previous one with the error messages showing...)
I do not see what is misleading about the window with successful build closing, as described in the guide and the batch file, the window is left open only when the build fails, so the build error messages remain available.

I want to install the static build version, if that can coexist with the debug/release versions. Do I just delete the two folders you mention  in cleaning the gcc builds, and run the static build batch file?
You are mixing two things here, static/shared (affected by the value of the build parameter "SHARED") and debug/release (affected by the value of the build parameter "BUILD"). They are used together, you cannot have one without other, e.g. you can have a static debug build, a shared release build, and/or any other of the four possible combinations. They do not affect each other. As described in the guide, the libraries for the debug build have an extra "d" in their name so they can coexist in the same folder with the release libraries. Also as described there, static builds are by default generated in "WXDIR/lib/gcc_lib" while the shared ones in "WXDIR/lib/gcc_dll".

You said that my guide is overly detailed for you, but as you can see, in the end you still need to know about all these supposed "details". Had you read the guide, you wouldn't have to ask and could have saved time and effort.

Anyway, I will not nag at you anymore, it seems that that I am either unable to properly explain even the most basic things or the communication between the two of us is somehow utterly broken.

Considering that doing the things described in my guide is actually the easy part and the difficult one comes with the programming itself, I can only wish you good luck.
« Last Edit: December 15, 2022, 01:15:36 pm by PB »

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: missing wx/setup.h
« Reply #23 on: December 15, 2022, 04:40:39 pm »
I don't see our communication as being broken. I ask a question, you point me in the right direction. When, earlier, I said that your guide was too complicated for me,( or whatever), that is not a reflection on your guide, but the fact that I had hoped that the whole installation to be simpler., my not knowing what was involved in getting wxWidgets to link statically.

Anyway, thanks for your help, the minimal build example works fine on my system.