Author Topic: compiler error  (Read 19253 times)

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
compiler error
« on: November 15, 2010, 04:44:59 am »
 :(,
met a problem when build wxWidget project, the error information is :


-------------- Build: Debug in testwxWidget1 ---------------

Compiling: testwxWidget1App.cpp
In file included from D:\wxWidgets-2.8.11\include/wx/string.h:55,
                 from D:\wxWidgets-2.8.11\include/wx/memory.h:16,
                 from D:\wxWidgets-2.8.11\include/wx/object.h:20,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:17,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.h:13,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.cpp:10:
D:\wxWidgets-2.8.11\include/wx/buffer.h: In constructor 'wxCharBuffer::wxCharBuffer(const char*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:127: error: 'strdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In member function 'wxCharBuffer& wxCharBuffer::operator=(const char*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:127: error: 'strdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In constructor 'wxWCharBuffer::wxWCharBuffer(const wchar_t*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:134: error: '_wcsdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In member function 'wxWCharBuffer& wxWCharBuffer::operator=(const wchar_t*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:134: error: '_wcsdup' was not declared in this scope
In file included from D:\wxWidgets-2.8.11\include/wx/memory.h:16,
                 from D:\wxWidgets-2.8.11\include/wx/object.h:20,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:17,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.h:13,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.cpp:10:
D:\wxWidgets-2.8.11\include/wx/string.h: In function 'int Stricmp(const char*, const char*)':
D:\wxWidgets-2.8.11\include/wx/string.h:141: error: 'strcasecmp' was not declared in this scope
In file included from D:\wxWidgets-2.8.11\include/wx/gdicmn.h:20,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:21,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.h:13,
                 from E:\project\codeBlocks\testwxWidget1\testwxWidget1App.cpp:10:
D:\wxWidgets-2.8.11\include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxChar*)':
D:\wxWidgets-2.8.11\include/wx/list.h:406: error: '_wcsdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxString&)':
D:\wxWidgets-2.8.11\include/wx/list.h:408: error: '_wcsdup' was not declared in this scope
Process terminated with status 1 (0 minutes, 1 seconds)
7 errors, 0 warnings (0 minutes, 1 seconds)

please give me some help, thanks ...

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: compiler error
« Reply #1 on: November 15, 2010, 05:25:39 am »
I think your mingw gcc or your compiler configure have something wrong, for I know 'strdup' declared in "string.h", which is in MinGW's include folder.
Regards,
xunxun

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #2 on: November 15, 2010, 06:24:14 am »
I think your mingw gcc or your compiler configure have something wrong, for I know 'strdup' declared in "string.h", which is in MinGW's include folder.
yep, I can open the string.h using right click on strdup "find declaration of 'strdup' ", so I think it does be in this scope, is there any possibility that I have installed cygwin in my pc leading to this problem ?

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #3 on: November 15, 2010, 06:39:49 am »
I think I have found the point. there is a "string.h" in mingw in codeblocks, but there is also a "string.h" in wxWidget, But I don't know how to let these two filed not confilcted, please give some advice.

regards
shawn

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: compiler error
« Reply #4 on: November 15, 2010, 06:52:12 am »
Well, but I think there is something wrong with your "stdlib.h".
Could you change another edition of mingw?
Regards,
xunxun

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #5 on: November 15, 2010, 10:41:21 am »
Well, but I think there is something wrong with your "stdlib.h".
Could you change another edition of mingw?

I have installed the lated mingw, and just change the compiler's installation directory in the tab "Toolchain executables", but it is still the same problems existed, can u give me some other suggestions . thanks

regards
shawn

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: compiler error
« Reply #6 on: November 15, 2010, 10:59:18 am »
If your mingw is integral, the problem is very strange.
Which edition of mingw did you use? And you can try the edition http://tdm-gcc.tdragon.net/.
Could you redownload the wxWidgets? I have no idea about the problems above.
Regards,
xunxun

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: compiler error
« Reply #7 on: November 15, 2010, 04:29:52 pm »
Turn on Full Compiler Logging
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

You most likely have an search directory wrong.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #8 on: November 16, 2010, 02:28:40 am »
Turn on Full Compiler Logging
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

You most likely have an search directory wrong.

Tim S.
I have done according what u said , but I still get the same problem as follows, and I think the compiler option is right :

-------------- Build: Debug in testwxwidget ---------------

mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wno-attributes -Wall  -g -D__WXDEBUG__  -std=c++0x   -ID:\wxWidgets-2.8.11\include -ID:\wxWidgets-2.8.11\contrib\include -ID:\wxWidgets-2.8.11\lib\gcc_dll\mswud -ID:\MinGW\include  -c E:\project\codeBlocks\testwxwidget\testwxwidgetApp.cpp -o obj\Debug\testwxwidgetApp.o
In file included from D:\wxWidgets-2.8.11\include/wx/string.h:55:0,
                 from D:\wxWidgets-2.8.11\include/wx/memory.h:16,
                 from D:\wxWidgets-2.8.11\include/wx/object.h:20,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:17,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxwidget\/testwxwidgetApp.h:13,
                 from E:\project\codeBlocks\testwxwidget\testwxwidgetApp.cpp:10:
D:\wxWidgets-2.8.11\include/wx/buffer.h: In constructor 'wxCharBuffer::wxCharBuffer(const char*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:127:1: error: 'strdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In member function 'wxCharBuffer& wxCharBuffer::operator=(const char*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:127:1: error: 'strdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In constructor 'wxWCharBuffer::wxWCharBuffer(const wchar_t*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:134:1: error: '_wcsdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/buffer.h: In member function 'wxWCharBuffer& wxWCharBuffer::operator=(const wchar_t*)':
D:\wxWidgets-2.8.11\include/wx/buffer.h:134:1: error: '_wcsdup' was not declared in this scope
In file included from D:\wxWidgets-2.8.11\include/wx/memory.h:16:0,
                 from D:\wxWidgets-2.8.11\include/wx/object.h:20,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:17,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxwidget\/testwxwidgetApp.h:13,
                 from E:\project\codeBlocks\testwxwidget\testwxwidgetApp.cpp:10:
D:\wxWidgets-2.8.11\include/wx/string.h: In function 'int Stricmp(const char*, const char*)':
D:\wxWidgets-2.8.11\include/wx/string.h:141:31: error: 'strcasecmp' was not declared in this scope
In file included from D:\wxWidgets-2.8.11\include/wx/gdicmn.h:20:0,
                 from D:\wxWidgets-2.8.11\include/wx/event.h:21,
                 from D:\wxWidgets-2.8.11\include/wx/app.h:20,
                 from E:\project\codeBlocks\testwxwidget\/testwxwidgetApp.h:13,
                 from E:\project\codeBlocks\testwxwidget\testwxwidgetApp.cpp:10:
D:\wxWidgets-2.8.11\include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxChar*)':
D:\wxWidgets-2.8.11\include/wx/list.h:406:36: error: '_wcsdup' was not declared in this scope
D:\wxWidgets-2.8.11\include/wx/list.h: In constructor 'wxListKey::wxListKey(const wxString&)':
D:\wxWidgets-2.8.11\include/wx/list.h:408:44: error: '_wcsdup' was not declared in this scope
Process terminated with status 1 (0 minutes, 1 seconds)
7 errors, 0 warnings (0 minutes, 1 seconds)

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: compiler error
« Reply #9 on: November 16, 2010, 03:35:02 am »
What version of MinGW GCC?
And, is it in this folder "D:\MinGW"?

Do you have any other MinGW installed in "E:\MinGW" or any other drive for E except D?

How did you install MinGW? Manually? Or using an Installer?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: compiler error
« Reply #10 on: November 16, 2010, 03:37:22 am »
Found cause "-std=c++0x" causes your problem on my machine.

Note: You might want to try "-std=gnu++0x" instead of "-std=c++0x".

Tim S.
« Last Edit: November 16, 2010, 03:42:52 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #11 on: November 16, 2010, 04:47:23 am »
What version of MinGW GCC?
And, is it in this folder "D:\MinGW"?

Do you have any other MinGW installed in "E:\MinGW" or any other drive for E except D?

How did you install MinGW? Manually? Or using an Installer?

Tim S.
version of MinGW GCC is 4.5.0, and yes, it does in folder D:\MinGW.
When I installed CB , it is integrated with mingw, But since there is some problems
, I reinstalled into D: disk using installer .


Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #12 on: November 16, 2010, 04:48:24 am »
Found cause "-std=c++0x" causes your problem on my machine.

Note: You might want to try "-std=gnu++0x" instead of "-std=c++0x".

Tim S.
sorry, I don't know what does this mean?

shawn

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #13 on: November 16, 2010, 04:50:21 am »
Found cause "-std=c++0x" causes your problem on my machine.

Note: You might want to try "-std=gnu++0x" instead of "-std=c++0x".

Tim S.
sorry, I don't know what does this mean?

shawn

and I can run the simple console application on my machine .

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: compiler error
« Reply #14 on: November 16, 2010, 06:36:39 am »
Found cause "-std=c++0x" causes your problem on my machine.

Note: You might want to try "-std=gnu++0x" instead of "-std=c++0x".

Tim S.
sorry, I don't know what does this mean?

shawn

Remove the Compiler Option "-std=c++0x" it DOES NOT work with wxWidgets 2.8.10.

Tim S.
« Last Edit: November 16, 2010, 06:40:28 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cxwshawn

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: compiler error
« Reply #15 on: November 16, 2010, 10:32:58 am »
Found cause "-std=c++0x" causes your problem on my machine.

Note: You might want to try "-std=gnu++0x" instead of "-std=c++0x".

Tim S.
sorry, I don't know what does this mean?

shawn

Remove the Compiler Option "-std=c++0x" it DOES NOT work with wxWidgets 2.8.10.

Tim S.

okay, thanks, I have got it resolved .

regards
shawn