Code: Select all
#include <wx/wx.h>
// #include "globals.h"
extern "C" {
char * Null_C_String;
int set_tuner(char *channel, int adapter, int frontend, int demux, char *confname);
};
int TuneChannel(wxString * channel, int adapter, int frontend,int demux, wxString config_filename)
{
if (config_filename.IsEmpty())
return set_tuner(channel->mb_str(),adapter,frontend,demux, Null_C_String);
else
return set_tuner(channel->mb_str(),adapter,frontend,demux, (config_filename.ToAscii()).mb_str());
}
// components of the favorites table
wxArrayInt FavPriority,FavChannelID,FavStop,FavStart;
wxArrayString FavTitle;
tony@X3 ~/oregano/src $ make globals.o
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -march=native -O2 -pipe -I/usr/lib64/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -MT globals.o -MD -MP -MF .deps/globals.Tpo -c -o globals.o globals.cpp
globals.cpp: In function 'int TuneChannel(wxString*, int, int, int, wxString)':
globals.cpp:13:76: error: invalid user-defined conversion from 'const wxScopedCharBuffer {aka const wxScopedCharTypeBuffer<char>}' to 'char*' [-fpermissive]
return set_tuner(channel->mb_str(),adapter,frontend,demux, Null_C_String);
^
In file included from /usr/include/wx-3.0/wx/strconv.h:17:0,
from /usr/include/wx-3.0/wx/strvararg.h:20,
from /usr/include/wx-3.0/wx/string.h:46,
from /usr/include/wx-3.0/wx/memory.h:15,
from /usr/include/wx-3.0/wx/object.h:19,
from /usr/include/wx-3.0/wx/wx.h:15,
from globals.cpp:1:
/usr/include/wx-3.0/wx/buffer.h:157:5: note: candidate is: wxScopedCharTypeBuffer<T>::operator const CharType*() const [with T = char; wxScopedCharTypeBuffer<T>::CharType = char] <near match>
operator const CharType *() const { return data(); }
^
/usr/include/wx-3.0/wx/buffer.h:157:5: note: no known conversion from 'const CharType* {aka const char*}' to 'char*'
globals.cpp:15:91: error: 'const wxScopedCharBuffer' has no member named 'mb_str'
return set_tuner(channel->mb_str(),adapter,frontend,demux, (config_filename.ToAscii()).mb_str());
^
Makefile:436: recipe for target 'globals.o' failed
make: *** [globals.o] Error 1
I don't understand why I have an error in the first call. I probably screwed up syntax in the second call, but the first call has no conversion. it calls an external C function passing an external C variable.