After doing all I know, and additional things I can find, to do this upgrade, when I attempt to compile I get this error:
-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
[ 7.1%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -IC:\wxWidgets-3.1.3\include -I..\Libraries\cminpack-1.3.6 -Iinclude\ -IC:\wxWidgets-3.1.2-posix\lib\gcc_dll\mswud -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -IC:\wxWidgets-3.1.3\include -I..\Libraries\cminpack-1.3.6 -Iinclude\ -IC:\wxWidgets-3.1.2-posix\lib\gcc_dll\mswud -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"' in 'C:\Software\Designer' failed
In this compile command I see "IC:\wxWidgets-3.1.2-posix\lib\gcc_dll\mswud". This is an out of date path. I have found where many of the paths are set, but not this one. Where is this one set?
This is a very terse error message that does not say what the error is. How can I get more verbose messages that do say what the error is?
That is where 3.1.2 was. I missed that earlier. Thanks. Now I am seeking to use the wx variable to make future upgrades easier. In the path: "Settings => Global variables => wx" I have these settings:
base: C:\wxWidgets-3.1.3
include:
lib: \lib\gcc_lib
bin: \bin
For my project, for which I will name here "Designer", I right click Designer in the Projects tab of the Management pane, and navigate the path: Designer => Build Options => Debug => Search Directories (tab) -> Compiler (tab) I have:
When I attempt to compile my project in Code::Blocks I get the error:
[ 14.3%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -I\lib\gcc_lib\gcc_dll\mswu -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -I\lib\gcc_lib\gcc_dll\mswu -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"' in 'C:\Software\Designer' failed.
In this compile command I see the path: -I\lib\gcc_lib\gcc_dll\mswu
My expectation was that the text "$(#wx.lib)" would be replaced by "C:\wxWidgets-3.1.3\lib\gcc_lib . This has not happened. The base "C:\wxWidgets-3.1.3\" is missing. Have I misunderstood how this global variable works?
For use in debug mode is a separate debug compilation of wxWidgets 3.1.3 required?
Thanks for your reply. I made all those global file fields blanks as you recommended. That path is now a valid one. I made a bad assumption when I thought the content of those fields would be appended to the base. I see now they are not, and are a complete replacement for what is default.
The project still does not compile. In the error message I see: -Winvalid-pch. I think this is a message from the make file that says something has gone wrong with precompiled headers. Your suggestions about troubleshooting this would be appreciated.
This is the command I used to compile wxWidgets.
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
It is copied from this web page: https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW
If I were to compile for those higher levels of debug ability, how would this be changed?
Post the current build log?
And, are you wanting to build an wxWidgets shared/DLL or a static library?
Because, what you have posted conflicts with each other.
Edit from build/msw/config.gcc
# Type of compiled binaries [debug,release]
BUILD ?= debug
# Should debugging info be included in the executables? The default value
# "default" means that debug info will be included if BUILD=debug
# and not included if BUILD=release. [0,1,default]
DEBUG_INFO ?= default
# Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
# but expensive assert checks are enabled, use 0 to completely remove debugging
# code. [0,1,default]
DEBUG_FLAG ?= 1
Edit2: To have the most debug information I think you need to use "DEBUG_FLAG=2" when building wxWidgets.
Edit3: See wx/debug.h for more information
Tim S.
Oops, for some unknown reason i thought he is building CodeBlocks ::) ;D
Well, but because he is not, it is easier to use a debug build of wxWidgets.
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug
This produces a variant with debug symbols and also enables the assertions. No need to mess around with debug levels, the default settings are good enough. Create a second configuration and link against that debug variant.
About possible PCH related problems, depending on the PCH strategy CodeBlocks might not delete a present PCH file. Check the output folders and remove all PCH files to start a fresh build.
I recompiled wxWidgets. This is the batch file I did it with:
REM Change the current working directory
cd C:\wxWidgets-3.1.3\build\msw
REM Compile the release version
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release clean
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release
REM Compile the debug version
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug clean
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug
In Code::Blocks, when I attempt to compile in debug my application that did compile before the wxWidgets upgrade, I still get an error:
-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
[ 5.0%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -c "C:\Software\Designer\wx_pch.h" -o "wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch"' in 'C:\Software\Designer' failed.
In: Settings => Compiler => Toolchain executables (tab):
Compilers installation directory: C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
C Compiler: gcc.exe
C++ Compiler: g++.exe
Linker for dynamic libs: gcc.exe
Linker for static libs: ar.exe
Debugger: GDB/CDB debugger: TDM-GCC-64
Resource compiler: windres.exe
Make program: mingw32-make.exe
The path to all of the above was checked using the "..." to the right of the above fields. For all of them they are:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
This same path is what was verified using the "where" command on gcc.exe, and g++.exe, when I checked which compilers compiled wxWidgets.
It appears that unchecking that box did not prevent wx_pch.h being in the compile, as is evident in the build log:
-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
[ 5.3%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -c C:\Engineering_Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -c C:\Engineering_Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o' in 'C:\Engineering_Software\TIA Designer' failed.
What is an effective way to exclude it? The contents of the wx_pch.h file:
#ifndef WX_PCH_H_INCLUDED
#define WX_PCH_H_INCLUDED
// basic wxWidgets headers
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#ifdef WX_PRECOMP
// put here all your rarely-changing header files
#endif // WX_PRECOMP
In project build options for Debug, which is the mode I am trying to compile in now, in the path Build options... => Debug => Search directories (tab) I have listed each tab's content below:
Compiler: $(#wx.lib)\gcc_dll\mswud
Linker: (#wx.lib)\gcc_dll
Resource compiler: (#wx.lib)\gcc_dll
In Global variables the value of wx.lib is blank. The global base is: C:\wxWidgets-3.1.3
I do not recall ever setting up a custom make file. Where do I look to verify it is a normal CB project?
This is wrong; but, not the cause of your problem.
Resource compiler: (#wx.lib)\gcc_dll
Note: You need to add "$(#wx.include)" to both Compiler and Resource compiler.
That might be causing the problem.
To see if using a Custom Makefile look at
Project -> Properties
Tab: Project Settings
Is "This is a custom makefile" checked?
Tim S.
I did these things as you recommended:
Added the $ sign where it was missing where the global wx was used.
Removed -include wx_pch.h" in "Other Compiler Options"
Added "$(#wx.include)" to both Compiler and Resource compiler.
I verified the checkbox at: Project => Properties => Project Settings (tab) => This is a custom makefile is, and has been, unchecked.
The error I get now:
[ 5.3%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -IC:\wxWidgets-3.1.3\include -c C:\Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -IC:\wxWidgets-3.1.3\include -c C:\Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o' in 'C:\Software\Designer' failed.
This is still showing "-DWX_PRECOMP" in the compile command. Should it?
Toolchain settings
Linker for dynamic libs: gcc.exe
The above setting is only valid for C programming!
Use below for C++ programming
Linker for dynamic libs: g++.exe
In "Global compiler settings" the compiler is set for "TDM-GCC-64". Is that the wrong one? I attempted change it to "GNU GCC Compiler". But I find that after I close "Global compiler settings" by clicking on "OK", and then reopen it, that it has, all on its own, reverted to "TDM-GCC-64". However "GNU GCC Compiler" does show as the compiler in "Project => Build options..."
I changed the linker to g++.exe
The ""C:\Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp" is a simplified a bit one for posting here. But that file does exist in the search path set for it.
I added "WXUSINGDLL"
The current build log:
-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
[ 5.3%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -DWXUSINGDLL -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -IC:\wxWidgets-3.1.3\include -c C:\Engineering_Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o
Execution of 'mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -DWXUSINGDLL -Winline -Wall -pg -m64 -g -g3 -I..\Libraries\cminpack-1.3.6 -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswud -IC:\wxWidgets-3.1.3\include -c C:\Engineering_Software\Libraries\cminpack-1.3.6\cpp\dpmpar.cpp -o obj\Debug\Libraries\cminpack-1.3.6\cpp\dpmpar.o' in 'C:\Engineering_Software\TIA Designer' failed.
This time I did not simplify the paths.
The cpb file is attached.
Changing to "TDM-GCC-64" in "Project -> Build Options" did it. The compiler is working now.
There still needs to be and adjustment made to the Linker. I get many errors of the form:
C:\Engineering_Software\TIA Designer\src\JunctionCap.cpp|332|undefined reference to `__imp__ZN11wxGridfData13UpdateDisplayEii'|
I re-enabled precompiled headers, and cleaned the project. I only get one error:
||=== Build: Debug in TIA Designer (compiler: TDM-GCC-64) ===|
||error: ld returned 1 exit status|
||=== Build failed: 1 error(s), 0 warning(s) (1 minute(s), 41 second(s)) ===|
There is no message here about what the error was. Maybe there is a clue in the warning messages. There are 308 warnings. This same code compiled and ran before I upgraded from wxWidgets 3.1.2 to 3.1.3, and I did not get these warnings. The below snippet of them shows only one of each error type. For each line in this snippet there are actually many more of same error.
C:\Engineering_Software\TIA Designer\src\wxComboBoxDataFilePD.cpp|16|warning: 'void wxComboBoxDataFilePD::InitDataPointers(PhotoDiode*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]|
C:\Engineering_Software\TIA Designer\src\wxComboBoxDataFilePD.cpp|141|warning: 'void wxComboBoxDataFilePD::UpdateDisplayFromDataFile()' redeclared without dllimport attribute after being referenced with dll linkage|
C:\Engineering_Software\TIA Designer\TIA_DesignerMain.cpp|1026|warning: cast between incompatible pointer to member types from 'void (TIA_DesignerFrame::*)(wxCommandEvent&)' to 'wxObjectEventFunction' {aka 'void (wxEvtHandler::*)(wxEvent&)'} [-Wcast-function-type]|
I suppressed most warnings. In the build log I see now this:
wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (4 minute(s), 19 second(s))
I suppressed most warnings. In the build log I now see this:
wx_pch.h.gch\Debug_TIA Designer_wx_pch_h_gch: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (4 minute(s), 19 second(s))
It is likely the file it complains about was there before, and I missed it, because I payed attention only to what is in red.
I disabled precompiled headers and the above error disappeared. Now there are many other warnings, and errors, that appear in related pairs, such as this:
C:\Engineering_Software\TIA Designer\src\Utilities.cpp|641|warning: 'void wxGridfData::AdjustMinGridHeight()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]|
C:\Engineering_Software\TIA Designer\src\opamp.cpp|210|undefined reference to `__imp__ZN11wxGridfData19AdjustMinGridHeightEv'|
When I had this compiling in wxWidgets 3.1.2, I did not need to declare anything with dllimport. I did an incorrect change in Code::Blocks configuration to make it expect it. What could that be?