Search code examples
c++codeblockswxwidgets

Making WxWidgets work in C++


I installed precompiled WxWidget libraries and tried to run the default program in CodeBlocks but it gives the following error:

    mingw32-g++.exe: error: bin\Release\new2.exe: No such file or directory

Paths for WxWidget Libraries and MinGW are already specified. My question is; How to make CodeBlocks generate a .exe file for WxWidgets project?

I have already tried all solutions listed in this question: "No such file or directory" error in CodeBlocks

Complete Build Log:

-------------- Build: Release in new2 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wno-unused-
local-typedefs -Wall -O2 -ID:\WxWidgets\wxWidgets2.8\include -I\msw -c 
C:\Users\ShifaShah\Documents\new2\new2App.cpp -o obj\Release\new2App.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wno-unused-
local-typedefs -Wall -O2 -ID:\WxWidgets\wxWidgets2.8\include -I\msw -c 
C:\Users\ShifaShah\Documents\new2\new2Main.cpp -o obj\Release\new2Main.o
windres.exe -ID:\WxWidgets\wxWidgets2.8\include -I\msw  -J rc -O coff -i 
C:\Users\SHIFAS~1\DOCUME~1\new2\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -L -o bin\Release\new2.exe obj\Release\new2App.o 
obj\Release\new2Main.o  obj\Release\resource.res -s -mthreads  -lwxmsw_core -lwxbase -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -
ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
mingw32-g++.exe: error: bin\Release\new2.exe: No such file or directory
Process terminated with status 1 (0 minute(s), 3 second(s))
1 error(s), 0 warning(s) (0 minute(s), 3 second(s))

Solution

  •  -L -o bin\Release\new2.exe
    

    Here's the problem. The -L flag requires an argument, but the usual argument (a directory to search for libraries) is not provided. So the next flag, -o, is interpreted as an argument to -L, and bin\Release\new2.exe is interpreted as a name of an input file, which of course doesn't exist yet.

    Check your compiler flags and make sure there's no stray -L anywhere, and no "additional libraries directory" is specified as a white space string or similar.