Author Topic: Trouble compiling/linkng wx library  (Read 2525 times)

Offline Charlie

  • Single posting newcomer
  • *
  • Posts: 5
Trouble compiling/linkng wx library
« on: April 30, 2023, 09:11:16 am »
Hi. I have just installed CodeBlocks and am having trouble building my first project. Whenever I try I get the following errors:

||=== Build: Debug in Project1 (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lwxmsw31ud|
ld.exe||cannot find C:\wxWidgets-3.2.1\lib\gcc_dll\mswu: Permission denied|
ld.exe||cannot find C:\wxWidgets-3.2.1\lib\gcc_dll\mswud: Permission denied|
||error: ld returned 1 exit status|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|

wxWidgets is installed in the root (C) directory and the file structure is exactly according to the error message. Then there are the "Permission denied" errors, but the access rights are fine. Can anyone help me with this? Thanks in anticipation.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: Trouble compiling/linkng wx library
« Reply #1 on: April 30, 2023, 10:52:58 am »
Post a full rebuild log in code tags, see this link

Offline Charlie

  • Single posting newcomer
  • *
  • Posts: 5
Re: Trouble compiling/linkng wx library
« Reply #2 on: April 30, 2023, 11:42:05 am »

-------------- Clean: Debug in Project1 (compiler: GNU GCC Compiler)---------------

Cleaned "Project1 - Debug"

-------------- Build: Debug in Project1 (compiler: GNU GCC Compiler)---------------

g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud -c C:\Users\paul\Development\CodeBlocks\Project1\Project1App.cpp -o obj\Debug\Project1App.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud -c C:\Users\paul\Development\CodeBlocks\Project1\Project1Main.cpp -o obj\Debug\Project1Main.o
windres.exe -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud  -J rc -O coff -i C:\Users\paul\DEVELO~1\CODEBL~1\Project1\resource.rc -o obj\Debug\resource.res
g++.exe -LC:\wxWidgets-3.2.1\lib\gcc_dll -o bin\Debug\Project1.exe obj\Debug\Project1App.o obj\Debug\Project1Main.o  obj\Debug\resource.res -mthreads  -lwxmsw31ud C:\wxWidgets-3.2.1\lib\gcc_dll\mswu C:\wxWidgets-3.2.1\lib\gcc_dll\mswud -mwindows
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxmsw31ud
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:\wxWidgets-3.2.1\lib\gcc_dll\mswu: Permission denied
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:\wxWidgets-3.2.1\lib\gcc_dll\mswud: Permission denied
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 19 second(s))
4 error(s), 0 warning(s) (0 minute(s), 19 second(s))
 

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: Trouble compiling/linkng wx library
« Reply #3 on: April 30, 2023, 05:16:07 pm »
Looks like you missed the code tags part of the link.

These directories should not be in the linker command line, it is trying to open them as libraries:
Code
C:\wxWidgets-3.2.1\lib\gcc_dll\mswu
C:\wxWidgets-3.2.1\lib\gcc_dll\mswud
Did you put them in the "Other linker options" box, near -mthreads? (they may be disguised as $(#wx32.lib)\mswu and $(#wx32.lib)\mswud). If so, remove them.

Offline Charlie

  • Single posting newcomer
  • *
  • Posts: 5
Re: Trouble compiling/linkng wx library
« Reply #4 on: May 01, 2023, 03:29:06 pm »

-------------- Clean: Debug in Project1 (compiler: GNU GCC Compiler)---------------

Cleaned "Project1 - Debug"

-------------- Build: Debug in Project1 (compiler: GNU GCC Compiler)---------------

g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud -c C:\Users\paul\Development\CodeBlocks\Project1\Project1App.cpp -o obj\Debug\Project1App.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud -c C:\Users\paul\Development\CodeBlocks\Project1\Project1Main.cpp -o obj\Debug\Project1Main.o
windres.exe -IC:\wxWidgets-3.2.1\include -IC:\wxWidgets-3.2.1\lib\gcc_dll\mswud  -J rc -O coff -i C:\Users\paul\DEVELO~1\CODEBL~1\Project1\resource.rc -o obj\Debug\resource.res
g++.exe -LC:\wxWidgets-3.2.1\lib\gcc_dll -o bin\Debug\Project1.exe obj\Debug\Project1App.o obj\Debug\Project1Main.o  obj\Debug\resource.res -mthreads  -lwxmsw31ud -mwindows
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxmsw31ud
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 23 second(s))
2 error(s), 0 warning(s) (0 minute(s), 23 second(s))
 

Offline Charlie

  • Single posting newcomer
  • *
  • Posts: 5
Re: Trouble compiling/linkng wx library
« Reply #5 on: May 01, 2023, 03:32:03 pm »
The entries were in "Link libraries" but not in "Other linker options". I removed them anyway and the result is as above. If I compile for release only I get "mingw32/bin/ld.exe: cannot find -lwxmsw31u". So I don't appear to have either of them. Question: Why is it looking for ....31u instead of ....32u since it is wxWidgets-3.2.1 that I am using?
« Last Edit: May 01, 2023, 04:01:41 pm by Charlie »

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: Trouble compiling/linkng wx library
« Reply #6 on: May 01, 2023, 03:58:41 pm »
inside your C:\wxWidgets-3.2.1\lib\gcc_dll folder you should have a dll with a name containing 32 and not 31. -lwxmsw31ud indicates a wxwidgets 3.1 debugging version which is probably not your case. If in this folder you have, as I suppose, but I'm not on your PC, a libwxmsw32u.a and a corresponding dll like wxmsw32u_gcc_custom.dll (the name may vary) you should use -lwxmsw32u which indicates a non debug version for wxwidgets 3.2 serie.
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 Charlie

  • Single posting newcomer
  • *
  • Posts: 5
Re: Trouble compiling/linkng wx library
« Reply #7 on: May 01, 2023, 04:15:44 pm »
Actually, all the lib files in that directory are 32s. There is no libwxmsw32u.a or libwxmsw32ud.a but plenty of others for ribbon, aui, xrc, webview, html, core ...etc. So should I download the non-debug version?
« Last Edit: May 01, 2023, 04:22:19 pm by Charlie »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Trouble compiling/linkng wx library
« Reply #8 on: May 01, 2023, 06:40:25 pm »
Actually, all the lib files in that directory are 32s. There is no libwxmsw32u.a or libwxmsw32ud.a but plenty of others for ribbon, aui, xrc, webview, html, core ...etc. So should I download the non-debug version?

The libwxmsw32u.a or libwxmsw32ud.a are monolithic build the others you mention are from multilib build (opposite of  monolithic).

Edit: The primary reason to use monolithic build is building Code::Blocks IDE (CB) or CB Plugins. Otherwise you likely wish to use multilib build of wxWidgets.

Tim S.
« Last Edit: May 02, 2023, 07:16:28 pm by stahta01 »
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