News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Trouble compiling/linkng wx library

Started by Charlie, April 30, 2023, 09:11:16 AM

Previous topic - Next topic

Charlie

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.

Miguel Gimenez


Charlie


-------------- 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))


Miguel Gimenez

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:

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.

Charlie


-------------- 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))


Charlie

#5
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?

gd_on

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 (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Charlie

#7
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?

stahta01

#8
Quote from: Charlie 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?

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]