Undefined Reference Errors

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

Re: Undefined Reference Errors

Post by spflanze » Mon Mar 02, 2020 7:48 pm

WX_CPU_AMD64 was removed from that wrong place.

With "--define WX_CPU_AMD64" in "Project => Compiler settings (tab) => Other resource compiler options (subtab)" I get this result:

Code: Select all

COLLECT_GCC_OPTIONS='-pipe' '-mthreads' '-Winvalid-pch' '-v' '-D' '__GNUWIN32__' '-D' '__WXMSW__' '-D' 'wxUSE_UNICODE' '-g' '-D' '__WXDEBUG__' '-D' 'WXUSINGDLL' '-Wfatal-errors' '-Wall' '-m64' '-Wno-deprecated-declarations' '-I' '..\Libraries\cminpack-1.3.6' '-I' 'C:\wxWidgets-3.1.3\include' '-I' 'include' '-I' 'C:\wxWidgets-3.1.3\lib\gcc_dll\mswud' '-I' 'C:\wxWidgets-3.1.3\include' '-I' 'C:\wxWidgets-3.1.3\' '-I' 'C:\wxWidgets-3.1.3' '-I' 'C:\wxWidgets-3.1.3\include' '-c' '-o' 'obj\Debug\TIA Designer\TIA_DesignerMain.o' '-shared-libgcc' '-mtune=core2' '-march=nocona'
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `obj\Debug\TIA Designer\resource.res' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 33 second(s))
With "windres.exe --define WX_CPU_AMD64" removed from "Other resource compiler options" above, and "windres.exe --define WX_CPU_AMD64" placed in the field at: "Settings => Compiler... => Toolchain executables (tab) => Program Files (subtab) => Resource compiler" I got the same result as above.

The entire build log is attached.

System information:
Intel(R) Core(TM) i7 CPU
64 bit Windows 7
Attachments
Build Log 2020-03-02.txt
(159.46 KiB) Downloaded 17 times

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined Reference Errors

Post by stahta01 » Mon Mar 02, 2020 8:32 pm

I have no idea; except that you should fix the errors the log shows about non existing folders.

You are going to have to build a new wxWidgets project using the Compiled wxWidgets and see if it is a CB global compiler setting that is causing the problem. It needs to be one that compiles a resource file to be a good test.

Tim S.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4265
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Undefined Reference Errors

Post by ONEEYEMAN » Mon Mar 02, 2020 8:49 pm

Hi,
As I said - try to build the "minimal" sample and see what command is used.
Then try to mimic them inside the C::B.

Thank you.

spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

Re: Undefined Reference Errors

Post by spflanze » Tue Mar 03, 2020 4:14 am

I understand that Code::Blocks is built using wxWidgets. Which compiler is used compile Code::Blocks nightly builds?

By minimal do you mean using the Wizard to create a minimal starter project to compile?

I opened the .cpb file, and did a search for those missing directories. The searches did not get any hits. So it must be a compiler setting that is doing it. I do not know right now where that is set.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4265
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Undefined Reference Errors

Post by ONEEYEMAN » Tue Mar 03, 2020 5:41 am

Hi,
What I mean is:

Code: Select all

cd wxWidgets/buildMSW/samples/minimal
make
./minimal
The buildMSW folder is the one from where you ran "configure" when building wxWidgets.

The last line should be running either under wine or in Windows.

Thank you.

spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

Re: Undefined Reference Errors

Post by spflanze » Thu Mar 05, 2020 2:52 am

On my system the minimal sample is on the path:
C:\wxWidgets-3.1.3\samples\minimal
The MS Windows 7 command prompt does not recognize the command "make". There is no make.exe in that minimal directory. I have recently installed CMake. Will that do?

Taking a cue from an earlier posting about files the compiler could not find, I decided to remove, and reinstall, the compiler. During the installation read something I had forgotten about. The path to the compiler must not include spaces. Earlier, when the compiler I removed was installed, I had chosen the default installation directory the compiler's installation program gave. The installation program is mingw-get-setup.exe downloaded from:
https://sourceforge.net/projects/mingw- ... installer/ ,
The default installation path it presented was "C:\Program Files" . I had chosen the default earlier, and there was the space. This time I chose a path outside this directory that had no spaces. I then removed the compiler installation that had been earlier installed in a subdirectory of "C:|Program File", and configured Code::Blocks to use that file.

The release version compiled, and I was able to run the application's release version. The debug version would not compile due to trouble with windres. The error message suggested it was due to a space being in the application's name. I removed the space. I also recompiled wxWidgets to cover the possibility that the compiler's former location created a troublesome wxWidgets installation.

The batch file I used to recompile:

Code: Select all

REM Change the current working directory to C:\wxWidgets-3.1.3\build\msw.
cd  C:\wxWidgets-3.1.3\build\msw

Echo *** Compile the debug version >LogDeb.txt
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" > LogSharedDebug.txt 2>&1

Echo *** Compile the release version >LogRel.txt
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" > LogSharedRelease.txt 2>&1
After doing the above I have now a new problem. The error is in this excerpt from the build log:

Code: Select all

[ 36.8%] windres.exe -IC:\wxWidgets-3.1.3\lib\gcc_dll\mswu -IC:\wxWidgets-3.1.3\include -IC:\wxWidgets-3.1.3\ -IC:\wxWidgets-3.1.3 -IC:\wxWidgets-3.1.3\include -pipe -mthreads -Winvalid-pch -v  -J rc -O coff -i C:\ENGINE~1\TIA_Designer\resource.rc -o obj\Release\TIA_Designer\resource.res
...
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -I ..\Libraries\cminpack-1.3.6 -I C:\wxWidgets-3.1.3\include -I include -I C:\wxWidgets-3.1.3\lib\gcc_dll\mswu -I C:\wxWidgets-3.1.3\include -I C:\wxWidgets-3.1.3\ -I C:\wxWidgets-3.1.3 -I C:\wxWidgets-3.1.3\include -o obj\Release\Libraries\cminpack-1.3.6\cpp\lmder.o
windres.exe: unknown option -- p
It is indicating option "-- p" is an error. But where windres.exe is executed in the log I do not see where this option is present in the command line. I looked through the project file's check boxes, and options tabs, and failed to see an option "p". What could be causing this?

The complete build log is attached.
Attachments
Build Log 2020-03-04.txt
(64.1 KiB) Downloaded 15 times

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined Reference Errors

Post by stahta01 » Thu Mar 05, 2020 3:30 am

Why are you adding random options to the resource compiler?

Example of one of the random options

Code: Select all

-pipe
Tim S.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined Reference Errors

Post by stahta01 » Thu Mar 05, 2020 3:58 am

I am starting to believe you are incapable of learning.
You keep doing things that make no sense.
I suggest you learn to use a version control system!
I suggest you learn how to get help for all the toolchain commands you use!
As in "windres --help".
I suggest you stop changing multiple things at the same time!

Are you really incapable of understanding that "make" relates to "mingw32-make" instead of "cmake"?

Tim S.

spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

Re: Undefined Reference Errors

Post by spflanze » Thu Mar 05, 2020 7:56 pm

Everything is working now. Thanks everyone for your help.

I did not recognize until now that "-p" and "-pipe" were terse, and verbose, versions of the same command.

The options:

Code: Select all

-pipe
-mthreads
-Winvalid-pch
-v
were supoposed to be only in the tab at: "Project => Build options => Other compiler options". When I accidentally copied them also into "Project => Build options => Other resource compiler options". It happened when I consolidated the Release, and Debug, project settings into where the project settings for both are.

I have been thoroughly documenting the set up this time, so that next time I have it to get out of trouble.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined Reference Errors

Post by stahta01 » Thu Mar 05, 2020 10:00 pm

Code: Select all

windres --use-temp-file -i../../samples/sample.rc -ogcc820W64x64_mswuddllmono\minimal_sample_rc.o    --define wxUSE_DPI_AWARE_MANIFEST=2 --define __WXMSW__       --define _UNICODE --include-dir .\..\..\lib\gcc820W64x64_dllmono\mswud --include-dir ./../../include  --include-dir . --define WXUSINGDLL --include-dir ./../../samples --define NOPCH
I did what the other poster suggested and built the minimal sample.

Maybe the above will help you; but, I used a different compiler than you did.

The define options are the ones you need to think about trying if you still have a rc file build error.

Edit: The "use-temp-file" option might be needed it gets around a bug in windres; I forget what the bug looks like.

Tim S.

Post Reply