Author Topic: Building Code::Blocks: error: ambiguous overload for 'operator[]'  (Read 16139 times)

Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
I just downloaded the latest trunk (5964) and am trying to build on a LINUX platform (Centos 5.4.3, all updates present, GCC 4.4.2, wx 2.9, etc.)

./boostrap and ./configure seem to go fine, then when I start the build process (make) I get the following errors:

In file included from ../../../src/include/sdk_common.h:59,
                 from ../../../src/include/sdk_precomp.h:13,
                 from tinywxuni.cpp:1:
/usr/include/wx-2.8/wx/filename.h: In static member function 'static wxChar wxFileName::GetPathSeparator(wxPathFormat)':
/usr/include/wx-2.8/wx/filename.h:393: error: ambiguous overload for 'operator[]' in 'wxFileName::GetPathSeparators(wxPathFormat)()[0u]'
/usr/include/wx-2.8/wx/filename.h:393: note: candidates are: operator[](const wxChar*, long int) <built-in>
/usr/include/wx-2.8/wx/string.h:822: note:                 wxChar& wxString::operator[](int)
/usr/include/wx-2.8/wx/string.h:824: note:                 wxChar& wxString::operator[](size_t)



Is this a code error or a build error on my part?  It seems to be a code problem.

Any suggestions?

-Kirk



-
« Last Edit: December 08, 2009, 06:51:29 pm by KirkD »

Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: ambiguous overload for 'operator[
« Reply #1 on: December 08, 2009, 06:46:36 pm »
I also see this list of warnings in the ./configure output - seems important.

checking fcntl.h usability... no
checking fcntl.h presence... yes
configure: WARNING: fcntl.h: present but cannot be compiled
configure: WARNING: fcntl.h:     check for missing prerequisite headers?
configure: WARNING: fcntl.h: see the Autoconf documentation
configure: WARNING: fcntl.h:     section "Present But Cannot Be Compiled"
configure: WARNING: fcntl.h: proceeding with the preprocessor's result
configure: WARNING: fcntl.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------- ##
configure: WARNING:     ## Report this to the codeblocks lists.  ##
configure: WARNING:     ## ------------------------------------- ##
checking for fcntl.h... yes
checking limits.h usability... no
checking limits.h presence... yes
configure: WARNING: limits.h: present but cannot be compiled
configure: WARNING: limits.h:     check for missing prerequisite headers?
configure: WARNING: limits.h: see the Autoconf documentation
configure: WARNING: limits.h:     section "Present But Cannot Be Compiled"
configure: WARNING: limits.h: proceeding with the preprocessor's result
configure: WARNING: limits.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------- ##
configure: WARNING:     ## Report this to the codeblocks lists.  ##
configure: WARNING:     ## ------------------------------------- ##
checking for limits.h... yes
checking for stdlib.h... (cached) no
checking for string.h... (cached) no
checking sys/param.h usability... no
checking sys/param.h presence... yes
configure: WARNING: sys/param.h: present but cannot be compiled
configure: WARNING: sys/param.h:     check for missing prerequisite headers?
configure: WARNING: sys/param.h: see the Autoconf documentation
configure: WARNING: sys/param.h:     section "Present But Cannot Be Compiled"
configure: WARNING: sys/param.h: proceeding with the preprocessor's result
configure: WARNING: sys/param.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------- ##
configure: WARNING:     ## Report this to the codeblocks lists.  ##
configure: WARNING:     ## ------------------------------------- ##
checking for sys/param.h... yes
checking for unistd.h... (cached) no
checking malloc.h usability... no
checking malloc.h presence... yes
configure: WARNING: malloc.h: present but cannot be compiled
configure: WARNING: malloc.h:     check for missing prerequisite headers?
configure: WARNING: malloc.h: see the Autoconf documentation
configure: WARNING: malloc.h:     section "Present But Cannot Be Compiled"
configure: WARNING: malloc.h: proceeding with the preprocessor's result
configure: WARNING: malloc.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------- ##
configure: WARNING:     ## Report this to the codeblocks lists.  ##
configure: WARNING:     ## ------------------------------------- ##

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #2 on: December 08, 2009, 07:00:54 pm »
What version of wxwidgets are you trying to use 2.8.?? or 2.9.?? please say which and fill in the ?? marks?

OS 32 or 64 bits?
Build 32 or 64 bits?

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 KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #3 on: December 08, 2009, 07:23:39 pm »
Tim:

I have wxBase 2.8.9 installed as per yum info wx*.  I also have wxGTK 2.8.10 and wxGTK-devel 2.8.10 installed.

In the./configure output I see:

checking for wxWidgets version > 2.8.0... yes (version 2.8.9). 

OS is 64-bit.

As for build 64-bit vs 32-bit, I'm not sure I understand the question.  I'm building in a 64-bit environment using 64-bit libraries.  Obviously there are 32-bit libraries floating around and compatibility libraries available, but I would assume I'm all 64-bit.

-Kirk





Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #4 on: December 08, 2009, 07:26:38 pm »
Tim:

I have wxBase 2.8.9 installed as per yum info wx*.  I also have wxGTK 2.8.10 and wxGTK-devel 2.8.10 installed.

In the./configure output I see:

checking for wxWidgets version > 2.8.0... yes (version 2.8.9).  

OS is 64-bit.

As for build 64-bit vs 32-bit, I'm not sure I understand the question.  I'm building in a 64-bit environment using 64-bit libraries.  Obviously there are 32-bit libraries floating around and compatibility libraries available, but I would assume I'm all 64-bit.

-Kirk

wxWidgets 2.8 is NOT 64 bit capable under windows; not sure what the status is for Linux.

Edit: The errors you are getting look like 32/64 bit issues.

Tim S.
« Last Edit: December 08, 2009, 07:32:25 pm 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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #5 on: December 08, 2009, 07:29:29 pm »
Tim: wx works 100% under linux 64bit

KirkD: do you have the -dev packages? linux-headers, full gcc. What is the output of wx-config?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #6 on: December 08, 2009, 07:36:05 pm »
All of my installs are x86_64 - usually i386 are also carried along.

I do have the -devel packages installed for wxGTK.  wxBase doesn't seem to have a -devel package.  If I do

yum info wxBase*

I get this:

Package wxBase is obsoleted by wxGTK, trying to install wxGTK-2.8.10-1.el5.rf.x86_64 instead
Package wxGTK-2.8.10-1.el5.rf.x86_64 already installed and latest version
Package wxBase is obsoleted by wxGTK, trying to install wxGTK-2.8.10-1.el5.rf.x86_64 instead
Package wxGTK-2.8.10-1.el5.rf.x86_64 already installed and latest version
Nothing to do


The LINUX headers (kernel-headers, kernel-devel) are also there.  I have the full GCC package also - built from scratch, full install, used to compile about a dozen other packages from source over the past week.

Output of wx-config is:

wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--release] [--version-full]
           [--list] [--selected-config] [--host=HOST] [--toolkit=TOOLKIT]
           [--universal[=yes|no]] [--unicode[=yes|no]] [--debug[=yes|no]]
           [--static[=yes|no]] [--version[=VERSION]] [--basename] [--cc]
           [--cppflags] [--cflags] [--cxxflags] [--rescomp] [--libs] [--cxx]
           [--ld] [--linkdeps] [--utility=UTIL] [LIB ...]

    wx-config returns information about the wxWidgets libraries available on
  your system.  It may be used to retrieve the information required to build
  applications using these libraries using --cppflags, --cflags,  --cxxflags
  and --libs options.

    If multiple builds of wxWidgets  are available,  you can use the options
  --prefix, --host, --toolkit, --unicode, --debug, --static, --universal and
  --version to select from them. The --selected-config option shows the name
  of the current configuration and --list shows available alternatives which
  match specified criteria. The --utility option returns the correct version
  of UTIL to use with the selected build. The --linkdeps option returns only
  static libraries for your makefile link rule dependencies.

    Optional LIB arguments (comma or space separated) may be used to specify
  the wxWidgets libraries that  you wish  to use.  The magic "std" label may
  be used to import all libraries that would be used by default if none were
  specified explicitly, e.g. wx-config --libs core,base.


Is there a specific command I should give?

-Kirk


« Last Edit: December 08, 2009, 07:39:34 pm by KirkD »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #7 on: December 08, 2009, 07:42:25 pm »
wx-config --list

IIRC, The above is a common way to see which wx libs you have under Linux.

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 KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #8 on: December 08, 2009, 08:19:10 pm »
wx-config --list gives:

Default config is gtk2-unicode-release-2.8

  Default config will be used for output



I'm beginning to wonder if the wx libraries available in the RH repos aren't the complete set needed to compile Code::Blocks.

Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #9 on: December 08, 2009, 08:58:42 pm »
I've just started a build on a fresh Fedora 12 install and it appears to be going fine.  It at least got past the point where the CentOS machine failed.  Unfortunately, this is an i386 install of Fedora, so I can't say for certain that there is no difference there.  I would suspect this is a distant possibility and that there is some difference in the installed libraries.  If anyone has any guess on how to diagnose the library differences, I would be very appreciative to hear them.

-Kirk


Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #10 on: December 08, 2009, 09:07:33 pm »
Could there be a difference between wx 2.8.9 (on my failing CentOS install) and 2.8.10 (on the currently working Fedora install)?


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #11 on: December 08, 2009, 11:35:46 pm »
Could there be a difference between wx 2.8.9 (on my failing CentOS install) and 2.8.10 (on the currently working Fedora install)?



If I understood correctly:
I have wxBase 2.8.9 installed as per yum info wx*.  I also have wxGTK 2.8.10 and wxGTK-devel 2.8.10 installed.
you have wxWidgets 2.8.9 and 2.8.10 mixed. This might cause problems.

I suggest removing 2.8.9 and only using 2.8.10.

I use wxWidgets from rpmforge on my virtual centos 5.4 box (but it's only 32-bit at the moment).

By the way: wxWidgets definitely works on 64-bit linuxes. I use it everyday on my debian machine, without any problems.


Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #12 on: December 09, 2009, 12:25:35 am »

you have wxWidgets 2.8.9 and 2.8.10 mixed. This might cause problems.

I suggest removing 2.8.9 and only using 2.8.10.



Yes, seems odd.  When I install via yum install wxGTK-devel I end up with wxGTK-2.8.10 which has wxBase-2.8.9 as a dependency.  Seems off, but that's the nature of it.

At this point it seems clear that there is something wrong with my wx configuration.  I've gone through a few iterations of building wx (ansi vs unicode - unicode fixes a few errors, --with-GTK vs. without - GTK fixes a few errors) but I still have a few errors.  I've removed all my installs (make uninstall in each directory) and yum erase'd all wx vestiges.  I'm actively working on this for wx:

../configure --enable-xrc --enable-monolithic --enable-unicode

Interestingly, on my fresh install of Fedora 12 (running in VirtualBox), the Code::Blocks build went first try, no errors, no dependencies.

-Kirk


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #13 on: December 09, 2009, 12:41:08 am »
If wxGTK-2.8.10 has wxBase-2.8.9 as dependency, something went wrong.
I don't think that this can work properly.

As written before I have wxwidgets from rpmforge (http://wiki.centos.org/AdditionalResources/Repositories/RPMForge) and it works without any such strange errors.
I don't know, whether 64-bit packages are also available fom there, but I think so.

Offline KirkD

  • Multiple posting newcomer
  • *
  • Posts: 77
Re: Building Code::Blocks: error: ambiguous overload for 'operator[]'
« Reply #14 on: December 09, 2009, 12:50:08 am »
RPMForge is in my repolist and that is where the packages I mentioned are coming from.  I just double checked and indeed if I issue

yum install wxGTK-devel

I get wxGTK-devel 2.8.10 along with wxBase 2.8.9.  This could be the source of the problem as you mentioned.  

Like I said, I removed all traces of wx from my system (packages and my custom builds) and then I went back to rebuild wx as per this page:  http://vunh.blogspot.com/2009/05/codeblocks-installation-in-centos.html

wx built fine and I now have it in a custom directory - /opt/wx/2.8 - I can't see that this should matter much.   Currently the Code::Blocks build as per:

./configure --with-contrib-plugins=all
make

is cruising along nicely.  It has definitely gone further than ever before.  Once it finishes - if it finishes - I'll post back here my results.

-Kirk


EDIT:  I corrected ./configure --enable-contrib-plugins=all to ./configure --with-contrib-plugins=all.
« Last Edit: December 09, 2009, 12:59:24 am by KirkD »