[cfe-users] question about compatibility with g++

Gary Steele gsteele13 at gmail.com
Sat Dec 20 09:13:01 PST 2014


Dear CFE users list,

I am working on porting a c++ code from linux/win32 to MacOS using
macports with Yosemite. In the latest release, they have now gone over
to using clang and clang++.

The problem I have is that the code I was using with g++ seems to be
quite incompatible with clang++, in particular, I am getting a lot
errors about candidate functions not being viable because of
mismatches of "const" argument declarations. I give a few examples
here:

spyview.C:129:26: error: no matching member function for call to 'labelfont'
            cmapch->menu()[ind].labelfont(FL_HELVETICA_ITALIC);
            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/opt/local/include/FL/Fl_Menu_Item.H:199:8: note: candidate function
not viable: 'this' argument has type 'const Fl_Menu_Item', but method
is not marked const
  void labelfont(Fl_Font a) {labelfont_ = a;}

spyview.C:1144:14: error: no matching function for call to 'basename'
  filename = basename(filename);
             ^~~~~~~~
/usr/include/libgen.h:40:7: note: candidate function not viable: 1st
argument ('const char *') would lose const qualifier
char    *basename(char *);

Are there any quick fixes for this, such as a compiler flag that
enables the compilation of "sloppy old" g++ code? Or another quick
fix? I'm a bit rusty on my c++ these days as I haven't coded in a
while and don't have a lot of free time these days either to dig too
hard into the code...

Thanks!
Gary

-- 
Dr. Gary Steele
Assistant Professor
Molecular Electronics Devices Group, Room F388
Kavli Institute of Nanoscience
Delft University of Technology
Lorentzweg 1, 2628 CJ Delft
The Netherlands
Office: +31-15-278-3402
Mobile: +31-64-667-4938
Email: g.a.steele at tudelft.nl
Website: http://steelelab.tudelft.nl



More information about the cfe-users mailing list