Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [solved]codeblocks doesn't build my application and give's this error  (Read 6621 times)

0 Members and 1 Guest are viewing this topic.

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
hi all, I want to build my app and got this error:
Code: [Select]
<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:
Code: [Select]
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 :'(
« Last Edit: January 09, 2014, 08:53:52 pm by amir ramezani »
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #1 on: January 08, 2014, 12:20:11 pm »
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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #2 on: January 08, 2014, 01:01:16 pm »
that isn't a syntax error, it is a command-line error
this is the build log:
Code: [Select]
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
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #3 on: January 08, 2014, 01:15:02 pm »
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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #4 on: January 08, 2014, 02:38:56 pm »
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
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

Barlog

  • Guest
Re: codeblocks doesn't build my application and give's this error
« Reply #5 on: January 08, 2014, 03:11:29 pm »
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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #6 on: January 08, 2014, 04:03:40 pm »
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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: codeblocks doesn't build my application and give's this error
« Reply #7 on: January 08, 2014, 05:55:09 pm »
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
« Last Edit: January 09, 2014, 08:53:09 pm by amir ramezani »
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

 

anything