Error: '_waccess' was not declared in this scope
Error: '_waccess' was not declared in this scope
Yesterday I built wxWidgets 3.1.0 using mingw (v2013072300). Using CodeBlocks and the same mingw I'm trying to compile a project, but I keep getting this error:
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
The project was just a basic empty form, the default project created when making a new wxWidgets project in CodeBlocks. Do any of you know what the solution to this problem might be?
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
The project was just a basic empty form, the default project created when making a new wxWidgets project in CodeBlocks. Do any of you know what the solution to this problem might be?
Re: Error: '_waccess' was not declared in this scope
Make sure you build the libraries and your project with the same Unicode settings.
Re: Error: '_waccess' was not declared in this scope
Might try defining
_UNICODE
in the CB Project.
Tim S.
_UNICODE
in the CB Project.
Tim S.
Re: Error: '_waccess' was not declared in this scope
I compiled wxWidgets to use unicode, and have these #defines for the project:
__GNUWIN32__
__WXMSW__
wxUSE_UNICODE
_UNICODE
Unfortunately it gives me the same error messages.
Is it possible I don't have the correct link libraries identified? These are what I have now...
libkernel32.a
libuser32.a
libgdi32.a
libwinspool.a
libcomdlg32.a
libadvapi32.a
libshell32.a
libole32.a
liboleaut32.a
libuuid.a
libcomctl32.a
libwsock32.a
libodbc32.a
libshlwapi.a
libversion.a
Since the _UNICODE define did not seem to affect anything I removed it again. Here is what the build log currently looks like...
-------------- Build: Release in TestProj (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=c++14 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
In file included from C:\wxWidgets-3.1.0\include/wx/utils.h:20:0,
from C:\wxWidgets-3.1.0\include/wx/cursor.h:75,
from C:\wxWidgets-3.1.0\include/wx/event.h:21,
from C:\wxWidgets-3.1.0\include/wx/app.h:19,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.h:13,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp:10:
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxAccess(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxChmod(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:424:45: error: '_wchmod' was not declared in this scope
{ return wxCRT_Chmod(path.fn_str(), mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxOpen(const wxString&, int, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:426:51: error: '_wopen' was not declared in this scope
{ return wxCRT_Open(path.fn_str(), flags, mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxStat(const wxString&, _stati64*)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:429:43: error: '_wstati64' was not declared in this scope
{ return wxCRT_Stat(path.fn_str(), buf); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxLstat(const wxString&, _stati64*)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:431:44: error: '_wstati64' was not declared in this scope
{ return wxCRT_Lstat(path.fn_str(), buf); }
^
__GNUWIN32__
__WXMSW__
wxUSE_UNICODE
_UNICODE
Unfortunately it gives me the same error messages.
Is it possible I don't have the correct link libraries identified? These are what I have now...
libkernel32.a
libuser32.a
libgdi32.a
libwinspool.a
libcomdlg32.a
libadvapi32.a
libshell32.a
libole32.a
liboleaut32.a
libuuid.a
libcomctl32.a
libwsock32.a
libodbc32.a
libshlwapi.a
libversion.a
Since the _UNICODE define did not seem to affect anything I removed it again. Here is what the build log currently looks like...
-------------- Build: Release in TestProj (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=c++14 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
In file included from C:\wxWidgets-3.1.0\include/wx/utils.h:20:0,
from C:\wxWidgets-3.1.0\include/wx/cursor.h:75,
from C:\wxWidgets-3.1.0\include/wx/event.h:21,
from C:\wxWidgets-3.1.0\include/wx/app.h:19,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.h:13,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp:10:
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxAccess(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxChmod(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:424:45: error: '_wchmod' was not declared in this scope
{ return wxCRT_Chmod(path.fn_str(), mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxOpen(const wxString&, int, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:426:51: error: '_wopen' was not declared in this scope
{ return wxCRT_Open(path.fn_str(), flags, mode); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxStat(const wxString&, _stati64*)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:429:43: error: '_wstati64' was not declared in this scope
{ return wxCRT_Stat(path.fn_str(), buf); }
^
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxLstat(const wxString&, _stati64*)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:431:44: error: '_wstati64' was not declared in this scope
{ return wxCRT_Lstat(path.fn_str(), buf); }
^
Re: Error: '_waccess' was not declared in this scope
wxUSE_UNICODE defines _UNICODE, so the latter is not needed explicitly.
Try building without -std=c++14
Remember, for the project you need the same defines the libs have
No, the libs do not matter at that step.
Try building without -std=c++14
Remember, for the project you need the same defines the libs have
No, the libs do not matter at that step.
Re: Error: '_waccess' was not declared in this scope
I changed it to c++11, but the error persists.
mingw32-g++.exe -Wall -std=c++11 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -std=c++11 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
mingw32-g++.exe -Wall -std=c++11 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -std=c++11 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
Re: Error: '_waccess' was not declared in this scope
You are making those changes to your project. Did you do the same for the libs, and build the libs after every change ?
Re: Error: '_waccess' was not declared in this scope
I've rebuilt it with these commands (in "c:\wxwidgets-3.1.0\build\msw"):
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release clean
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release
Then I tried to compile the project and it still fails with the same error message. Are these commands adequate or should I change anything? What else could be causing the errors?
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release clean
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release
Then I tried to compile the project and it still fails with the same error message. Are these commands adequate or should I change anything? What else could be causing the errors?
Re: Error: '_waccess' was not declared in this scope
So do you want to use c++11 features in your application or not? If you do, you need to compile wxWidgets AND your app the same way. In MinGW, the standard used affects a lot of declarations, see e.g. here..
You can build wxWidgets in c++11 mode with
The official wxWidgets documentation recommends to use gnu++11 instead though, so the command should be
Obviously, you need to use the same standard for the library and your application.
You can build wxWidgets in c++11 mode with
Code: Select all
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release CXXFLAGS="-std=c++11"
Code: Select all
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release CXXFLAGS="-gnu=c++11"
Re: Error: '_waccess' was not declared in this scope
I'm getting an error when attempting to compile wxWidgets with CXXFLAGS="-gnu=c++11".
I'm instead compiling with CXXFLAGS="-std=gnu++11" and will report back when I've tested the new build.
I'm instead compiling with CXXFLAGS="-std=gnu++11" and will report back when I've tested the new build.
Re: Error: '_waccess' was not declared in this scope
After compiling again, it still doesn't work.
Here's what I ran:
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release CXXFLAGS="-std=gnu++11"
Could the error I'm getting have anything to do with my running CodeBlocks on 32-bit Vista? Any other ideas?
-------------- Build: Release in TestProj (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -std=c++11 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
In file included from C:\wxWidgets-3.1.0\include/wx/utils.h:20:0,
from C:\wxWidgets-3.1.0\include/wx/cursor.h:75,
from C:\wxWidgets-3.1.0\include/wx/event.h:21,
from C:\wxWidgets-3.1.0\include/wx/app.h:19,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.h:13,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp:10:
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxAccess(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
etc...
Here's what I ran:
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release CXXFLAGS="-std=gnu++11"
Could the error I'm getting have anything to do with my running CodeBlocks on 32-bit Vista? Any other ideas?
-------------- Build: Release in TestProj (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -std=c++11 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
In file included from C:\wxWidgets-3.1.0\include/wx/utils.h:20:0,
from C:\wxWidgets-3.1.0\include/wx/cursor.h:75,
from C:\wxWidgets-3.1.0\include/wx/event.h:21,
from C:\wxWidgets-3.1.0\include/wx/app.h:19,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.h:13,
from C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp:10:
C:\wxWidgets-3.1.0\include/wx/filefn.h: In function 'int wxAccess(const wxString&, mode_t)':
C:\wxWidgets-3.1.0\include/wx/filefn.h:422:46: error: '_waccess' was not declared in this scope
{ return wxCRT_Access(path.fn_str(), mode); }
etc...
Re: Error: '_waccess' was not declared in this scope
Did you try what people told you to, i.e., build the library and application with the same C++ flavour and unless you are building 3.1 GIT head that flavour being "gnu++11"?
I strongly advise you:
1. Read the wxWidgets install instructions in WXWIN/docs/msw/install.txt
2. Take a look at the gcc makefile for the minimal sample to see what flags it actually uses.
Additionally, I never used a command line to build my applications but shouldn't the build-specific include folder (e.g. WXWIN/lib/gcc_lib/mswu) come before the general one (WXWIN/include)?
BTW, you are using Code::Blocks: is the gcc command line generated by C::B for a project created on its wxWidgets GUI template?
Building regular wxWidgets application is usually a pretty simple, painless and straightforward process, you are not supposed to waste time on it...
Please try this (assuming you did not modify setup.h):
1. Delete WXWIN/build/msw/gcc_mswu and WXWIN/lib/gcc_lib folders
2. Build wxWidgets with
3. Make a clean build of your app with (assuming C:\wxWidgets-3.1.0\lib\gcc_lib is where built wxWidgets) in the previous step.
What does __GNUWIN32__ do? Is it defined during building wxWidgets (I don't think it is)? As I wrote above various definitions as well as C++ standard affect function declarations in MinGW.Lowkus wrote:After compiling again, it still doesn't work.
Here's what I ran:
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release CXXFLAGS="-std=gnu++11"
mingw32-g++.exe -Wall -std=c++11 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -IC:\wxWidgets-
I strongly advise you:
1. Read the wxWidgets install instructions in WXWIN/docs/msw/install.txt
2. Take a look at the gcc makefile for the minimal sample to see what flags it actually uses.
Additionally, I never used a command line to build my applications but shouldn't the build-specific include folder (e.g. WXWIN/lib/gcc_lib/mswu) come before the general one (WXWIN/include)?
BTW, you are using Code::Blocks: is the gcc command line generated by C::B for a project created on its wxWidgets GUI template?
Building regular wxWidgets application is usually a pretty simple, painless and straightforward process, you are not supposed to waste time on it...
Please try this (assuming you did not modify setup.h):
1. Delete WXWIN/build/msw/gcc_mswu and WXWIN/lib/gcc_lib folders
2. Build wxWidgets with
Code: Select all
mingw32-make -f makefile.gcc SHARED=0 BUILD=release CXXFLAGS="-std=gnu++11"
Code: Select all
mingw32-g++.exe -Wall -std=gnu++11 -pipe -mthreads -O2 -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.0\include -c C:\Users\Mark\Documents\cProjects\TestProj\TestProjApp.cpp -o obj\Release\TestProjApp.o
Re: Error: '_waccess' was not declared in this scope
I see you are still posting about how you are compiling your project, and how you have changed the build command (of your project?). Again, as explicit as I can be:
What is the compile command you used for building the libs?
What is the compile command you used for building your project?
What is the compile command you used for building the libs?
What is the compile command you used for building your project?
Re: Error: '_waccess' was not declared in this scope
Catalin, perhaps I am missing something, I thought I'd already posted the compile commands that I've been using. I've attached an image of the compiler settings; if there is something I need to modify so that the app builds how you're saying it should build then please let me know.
PB, I do not know what __GNUWIN32__ does, it was autogenerated by the CodeBlocks project creation wizard. I will try some of the steps you mentioned.
PB, I do not know what __GNUWIN32__ does, it was autogenerated by the CodeBlocks project creation wizard. I will try some of the steps you mentioned.
Re: Error: '_waccess' was not declared in this scope
Do not try SOME steps, do them all, they are related. In particular, make sure that C++ standard option is the same. You cannot set gnu++11 via C:B compiler flags tab, you must make sure that none of the c++ standards is selected there and add "-std=gnu++11" in Other Compiler options tab.Lowkus wrote:PB, I do not know what __GNUWIN32__ does, it was autogenerated by the CodeBlocks project creation wizard. I will try some of the steps you mentioned.
BTW, can you build wxWidgets minimal sample (using the same command line you build wxWidgets but running it from WXWIN/samples/minimal folder)?
Edit: I have just tried to rebuild wxWidgets project created by C::B wizard, works as expected (MinGW 5.3):
wxWidgets were built as usual (very recent GIT master):-------------- Clean: Release in aaa (compiler: GNU GCC Compiler)---------------
Cleaned "aaa - Release"
-------------- Build: Release in aaa (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=gnu++11 -IL:\Dev\Desktop\wxWidgets-GIT\include -IL:\Dev\Desktop\wxWidgets-GIT\lib\gcc_lib\mswu -c C:\aa\aaa\aaaApp.cpp -o obj\Release\aaaApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=gnu++11 -IL:\Dev\Desktop\wxWidgets-GIT\include -IL:\Dev\Desktop\wxWidgets-GIT\lib\gcc_lib\mswu -c C:\aa\aaa\aaaMain.cpp -o obj\Release\aaaMain.o
windres.exe -IL:\Dev\Desktop\wxWidgets-GIT\include -IL:\Dev\Desktop\wxWidgets-GIT\lib\gcc_lib\mswu -J rc -O coff -i C:\aa\aaa\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -LL:\Dev\Desktop\wxWidgets-GIT\lib\gcc_lib -o bin\Release\aaa.exe obj\Release\aaaApp.o obj\Release\aaaMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_aui -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lversion -lshlwapi -loleacc -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32
Output file is bin\Release\aaa.exe with size 5.58 MB
Process terminated with status 0 (0 minute(s), 12 second(s))
0 error(s), 0 warning(s) (0 minute(s), 12 second(s))
Code: Select all
mingw32-make -f makefile.gcc BUILD=release CXXFLAGS="-std=gnu++11" setup_h
mingw32-make -j2 -f makefile.gcc BUILD=release CXXFLAGS="-std=gnu++11"