SFML community forums
Help => General => Topic started by: amir ramezani on January 08, 2014, 12:11:58 pm
-
hi all, I want to build my app and got this error:
<command-line>:0:9: error: expected unqualified-id before numeric constant
I'm using Code::Blocks and GCC 4.8.2 (MinGW) this is the command to build my source file:
g++.exe -std=c++11 -Wall -DHAVE_W32API_H -D__WXMSW__ -DwxUSE_UNICODE -DwxUSE_UNICODE_MSLU -DCRYPTOPP_ENABLE_NAMESPACE_WEAK -DBOOST_THREAD_USE_LIB -Dunicode
-DSFML_STATIC -g -IC:\Dev-Cpp\include -c F:\projects\cpp\AGK\AGK.cpp -o obj\Debug\AGK.o
I haven't got this error in all of my projects such as my Operating system and everything that I'm writing >:(
that is code to build a debug version
I don't know what is that problem :'(
-
Quickly typing the error in Google, reveals that it's most likely just a simple syntax error.
Can you post the code where of where the compile complains?
-
that isn't a syntax error, it is a command-line error
this is the build log:
Audio Game Kit build log
Build started on: 08-01-2014 at 14:27.48
Build ended on: 08-01-2014 at 14:27.53
-------------- Build: Debug in Audio Game Kit (compiler: GNU GCC Compiler)---------------
g++.exe -std=c++11 -Wall -DHAVE_W32API_H -D__WXMSW__ -DwxUSE_UNICODE -DwxUSE_UNICODE_MSLU -DCRYPTOPP_ENABLE_NAMESPACE_WEAK -DBOOST_THREAD_USE_LIB -Dunicode
-DSFML_STATIC -g -IC:\Dev-Cpp\include -c F:\projects\cpp\AGK\AGK.cpp -o obj\Debug\AGK.o
<command-line>:0:9: error: expected unqualified-id before numeric constant
In file included from c:\dev-cpp\include\windows.h:55:0,
from c:\dev-cpp\include\screenreaderapi.h:6,
from F:\projects\cpp\AGK\AGK.cpp:17:
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':
c:\dev-cpp\include\wx\msw\winundef.h:38:20: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__*
CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'
return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
^
In file included from c:\dev-cpp\include\wx\defs.h:3450:0,
from c:\dev-cpp\include\wx\wx.h:14,
from F:\projects\cpp\AGK\AGK.cpp:36:
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD,
LPCTSTR)':
c:\dev-cpp\include\wx\msw\winundef.h:69:48: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__*
CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'
family, facename);
^
In file included from c:\dev-cpp\include\windows.h:55:0,
from c:\dev-cpp\include\screenreaderapi.h:6,
from F:\projects\cpp\AGK\AGK.cpp:17:
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':
c:\dev-cpp\include\wx\msw\winundef.h:94:20: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__*
CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'
return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
^
In file included from c:\dev-cpp\include\wx\defs.h:3450:0,
from c:\dev-cpp\include\wx\wx.h:14,
from F:\projects\cpp\AGK\AGK.cpp:36:
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':
c:\dev-cpp\include\wx\msw\winundef.h:111:44: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__*
LoadMenuW(HINSTANCE, LPCWSTR)'
return LoadMenuW(instance, name);
^
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HWND__* FindText(LPFINDREPLACE)':
c:\dev-cpp\include\wx\msw\winundef.h:126:43: error: cannot convert 'LPFINDREPLACE {aka FINDREPLACEA*}' to 'LPFINDREPLACEW {aka FINDREPLACEW*}' for argument
'1' to 'HWND__* FindTextW(LPFINDREPLACEW)'
return FindTextW(lpfindreplace);
^
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':
c:\dev-cpp\include\wx\msw\winundef.h:311:51: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__*
LoadIconW(HINSTANCE, LPCWSTR)'
return LoadIconW(hInstance, lpIconName);
^
c:\dev-cpp\include\wx\msw\winundef.h: In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':
c:\dev-cpp\include\wx\msw\winundef.h:324:55: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__*
LoadBitmapW(HINSTANCE, LPCWSTR)'
return LoadBitmapW(hInstance, lpBitmapName);
^
Process terminated with status 1 (0 minute(s), 5 second(s))
8 error(s), 0 warning(s) (0 minute(s), 5 second(s))
the other errors are for wxWidgets, and after I write my implementation, they'll be fixed
but the first one is for command-line and I don't know how to fix it
when I select the error from the list, nothing happen's and CB doesn't go there for fixing the problem
now, what can I do?
I've search it in google, but I don't found anything
-
Ah since you cut them apart it wasn't obvious. :)
Well the numbers ":0:9:" indicate that the error is on line 0 character 9, which seems to be the "11" of "-std=c++11", but I've no idea why it would error out at that point...
Since you're using 4.8.x you don't need to specify -std=c++11 (iirc).
Is there a reason you use the testing 4.8.2 branch of MinGW instead of the stable 4.8.1?
-
I'm using the updated compiler of MinGW.org, not TDM
if I don't write -std=gnu++11, it doesn't support C++11
I've tried it in some of my projects
I've tried to remove -Wall, but that error occur's
-
I'm using the updated compiler of MinGW.org, not TDM
if I don't write -std=gnu++11, it doesn't support C++11
Amir, I'm using MinGW "distro" from http://nuwen.net/mingw.html for my software dev on windows systems. You should give it a try.
You will need to change GCC compiler executable names in codeblocks compiler settings to make it work.
Nuwen distro GCC is in c++11 mode by default.
-
if I don't write -std=gnu++11, it doesn't support C++11
Well my bad, I thought GCC had changed their defaults, but apparently only a few builders did so (i.e. nuwen), thus you'll have to keep specifying -std=c++11...
If you use a simple application and try to compile it with -std=c++11 does it fail as well?
-
I can compile all of my other projects and I don't get that error
but, this give's that error
I've wrote a makefile and wrote the command that codeblocks use's it to build my application, and the same error
I don't think the problem is in my code