← Back to team overview

kicad-developers team mailing list archive

Re: REV:3270 Build error


On 12/05/2011 05:08 PM, Brian Sidebotham wrote:
> Hi Dick,
> I'm getting the following build error with rev 3270:
> kicad\pcbnew\kicad_plugin.cpp: In member function 'void
> KICAD_PLUGIN::loadAllSections(bool)':
> kicad\pcbnew\kicad_plugin.cpp:309:5: error: call of overloaded
> 'IO_ERROR(const char [74], const char*, const char [20])' is ambiguous
> kicad\include/richio.h:99:5: note: candidates are:
> IO_ERROR::IO_ERROR(const char*, const char*, const std::string&)
> kicad\include/richio.h:92:5: note:
> IO_ERROR::IO_ERROR(const char*, const char*, const wxString&)

The 2nd of the two hunks in the attached, already *committed* patch seem to fix this for
wxWidgets 2.9.x.  And it still works for 2.8.

(The first hunk was just a way to unify the __LOC__ strategy for _MSC_VER and gcc.)

Should fly now, but you will still get warnings from kicad_plugin.cpp, which pertain to
variables which I am refusing to stuff into globals.  I want to put those globals into the
BOARD first.

I am mostly tied up today with other stuff.

*) kicad_plugin.cpp is not being called yet, so if you still have grief with it, comment
it out in pcbnew/CMakeLists.txt.  I just wanted to start linking it in so that we could
smoke out issues like this before we start calling it. 

There are just a few minor problems with calling it remaining.  This is why we have the
parallel load path during testing.  We will be able to load an old board file with the new
loader, and save it with the old saver.  The result should be identical to a save/load
cycle using the old loader, and old saver, no?

We'll see.


=== modified file 'include/richio.h'
--- include/richio.h	2011-12-02 21:56:47 +0000
+++ include/richio.h	2011-12-06 06:17:38 +0000
@@ -56,10 +56,7 @@
 // use one of the following __LOC__ defs, depending on whether your
 // compiler supports __func__ or not, and how it handles __LINE__
-#if defined ( _MSC_VER )
-#define __func__ __FUNCTION__
-#define __LOC__         ((std::string(__func__) + "() : line ") + TOSTRING(__LINE__)).c_str()
+#define __LOC__         ((std::string(__FUNCTION__) + "() : line ") + TOSTRING(__LINE__)).c_str()
 //#define __LOC__         TOSTRING(__LINE__)
 /// macro which captures the "call site" values of __FILE_ & __LOC__
@@ -96,12 +93,19 @@
         init( aThrowersFile, aThrowersLoc, aMsg );
+#if !wxCHECK_VERSION(2, 9, 0)
+    // 2.9.0 and greater provide a wxString() constructor taking "const char*" whereas
+    // 2.8 did not.  In 2.9.x this IO_ERROR() constructor uses that wxString( const char* )
+    // constructor making this here constructor ambiguous with the IO_ERROR()
+    // taking the wxString.
     IO_ERROR( const char* aThrowersFile,
               const char* aThrowersLoc,
               const std::string& aMsg )
         init( aThrowersFile, aThrowersLoc, wxString::FromUTF8( aMsg.c_str() ) );
      * handles the case where _() is passed as aMsg.

Follow ups