www.digitalmars.com         C & C++   DMDScript  

c++ - Strange error compiling wxwindows-2.4.2

reply "grammer" <pgrammer_81 hotmail.com> writes:
OK, I have the version 8.38 of the digitalmars compiler and version 2.4.2 of
wxwindows. I have not modified wxwindows in any way. I have used the
makefiles provided for the symantec compiler (sc). Everything almost works
perfectly except for one thing. The compiler hiccoughs on fileconf.cpp. This
is the error msg:

-I..\../src/regex;..\../src/png;..\../src/jpeg;..\../src/zlib;..\../src/tiff
..\..\src\common\fileconf.cpp -o..\..\src\common\fileconf.obj
                ((m_linesTail) ? m_linesTail->Text().c_str() :
wxEmptyString) );

^
..\..\src\common\fileconf.cpp(1209) : Error: ambiguous reference to symbol
Had: wxLogTrace(char const *,...)
and: wxLogTrace(char const *,char const *,...)
--- errorlevel 1

--- errorlevel 1


And these are the offending lines of code:


    wxLogTrace( _T("wxFileConfig"),
                _T("        head: %s"),
                ((m_linesHead) ? m_linesHead->Text().c_str() :
wxEmptyString) );
    wxLogTrace( _T("wxFileConfig"),
                _T("        tail: %s"),
                ((m_linesTail) ? m_linesTail->Text().c_str() :
wxEmptyString) );

I assume the compiler is having problems disambiguating these overloaded
function definitions from log.h (#included in fileconf.cpp)

inline void wxLogTrace(const wxChar *, ...) { }
inline void wxLogTrace(const wxChar *, const wxChar *, ...) { }

Honestly, these overloads seem a little peculiar to me so I can understand
why the compiler might be confused. This is the strange part though.. If I
comment out any of the two function calls it compiles without complaint.
Even more bizarre, it compiles without error if I place a line of code
between the calls to wxLogTrace. For example:

    wxLogTrace( _T("wxFileConfig"),
                _T("        head: %s"),
                ((m_linesHead) ? m_linesHead->Text().c_str() :
wxEmptyString) );

    int i = 0;

    wxLogTrace( _T("wxFileConfig"),
                _T("        tail: %s"),
                ((m_linesTail) ? m_linesTail->Text().c_str() :
wxEmptyString) );

Believe it or not, that compiles without error. I have been able to build
and use the library by utilizing that trick. However, I'm really curious to
know whether anyone else has experienced this and what a better fix might
be.

BTW, I must say that dmc's compilation speeds are insane! I do mostly
windows programming so I am in the process of switching from g++. BIG
difference. Great work!
Dec 15 2003
parent reply "_" <mjoyl lineone.netX> writes:
"grammer" <pgrammer_81 hotmail.com> wrote in message
news:brlppd$1v8d$1 digitaldaemon.com...
 OK, I have the version 8.38 of the digitalmars compiler and version 2.4.2
of
 wxwindows. I have not modified wxwindows in any way. I have used the
 makefiles provided for the symantec compiler (sc). Everything almost works
 perfectly except for one thing. The compiler hiccoughs on fileconf.cpp.
This
 is the error msg:

 -I..\../src/regex;..\../src/png;..\../src/jpeg;..\../src/zlib;..\../src/ti
ff
 ..\..\src\common\fileconf.cpp -o..\..\src\common\fileconf.obj
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 ^
 ..\..\src\common\fileconf.cpp(1209) : Error: ambiguous reference to symbol
 Had: wxLogTrace(char const *,...)
 and: wxLogTrace(char const *,char const *,...)
 --- errorlevel 1

 --- errorlevel 1
I too recently experienced that with 2.4.2... but not with 2.4.1 patched for .dmc makefiles.... so in a totally cavaleer act of what the heck try anything once... I took the fileconf.cpp from 2.4.1 and dropped it in the 2.4.2 tree and re-ran the make... it compiled and built the lib fine... no idea what problems i'll run into down the road but at least i can play for now. If I had a clue about C++ I'd probably have something constructive to add but i'm trying to use this to learn with so can't understand why just that pair throw up the error when the same style statements appear elsewhere in that file... or look like they do to me. My intuition said compiler error and not an actual source file error.
 And these are the offending lines of code:


     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );
     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 I assume the compiler is having problems disambiguating these overloaded
 function definitions from log.h (#included in fileconf.cpp)

 inline void wxLogTrace(const wxChar *, ...) { }
 inline void wxLogTrace(const wxChar *, const wxChar *, ...) { }

 Honestly, these overloads seem a little peculiar to me so I can understand
 why the compiler might be confused. This is the strange part though.. If I
 comment out any of the two function calls it compiles without complaint.
 Even more bizarre, it compiles without error if I place a line of code
 between the calls to wxLogTrace. For example:

     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );

     int i = 0;

     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 Believe it or not, that compiles without error. I have been able to build
 and use the library by utilizing that trick. However, I'm really curious
to
 know whether anyone else has experienced this and what a better fix might
 be.
I prefer your workaround and will be recompiling the 2.4.2 file tomorrow with a similar inocuos statement inserted... maybe ifdef'd just for DMC ;-)
 BTW, I must say that dmc's compilation speeds are insane! I do mostly
 windows programming so I am in the process of switching from g++. BIG
 difference. Great work!
Dec 15 2003
next sibling parent reply arjan someplace.nl writes:
     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );
     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );
Make this single line statements, then you will be fine. It is a problem in the compiler, it sometimes has difficulties parsing multiple line statements like this. Arjan
Dec 16 2003
parent reply "grammer" <pgrammer_81 hotmail.com> writes:
<arjan someplace.nl> wrote in message
news:brmfk6$314i$1 digitaldaemon.com...
     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );
     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );
Make this single line statements, then you will be fine. It is a problem in the compiler, it sometimes has difficulties parsing
multiple
 line statements like this.

 Arjan
Thanks for the suggestion but I made the function calls one-liners and I got the same error message. For some reason, the compiler seems not to like the two near identical function calls next to each other.
Dec 16 2003
parent "_" <mjoyl lineone.netX> writes:
"grammer" <pgrammer_81 hotmail.com> wrote in message
news:brmue6$l86$1 digitaldaemon.com...
 <arjan someplace.nl> wrote in message
 news:brmfk6$314i$1 digitaldaemon.com...
     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );
     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );
Make this single line statements, then you will be fine. It is a problem in the compiler, it sometimes has difficulties parsing
multiple
 line statements like this.

 Arjan
Thanks for the suggestion but I made the function calls one-liners and I
got
 the same error message. For some reason, the compiler seems not to like
the
 two near identical function calls next to each other.
This may make little difference to a multimegabye exe but instead of assigning an unused int try pLine = pLine; that's a local variable and it allows dmc to get back on track without really altering the program. Just wondering here (remember I be a total newbie so could be totally wrong) the "delete pLine;" statement on the end of that function... none of the problem statements use pLine so could the delete pLine; be placed in between and not affect the operation of the function?
Dec 16 2003
prev sibling parent "grammer" <pgrammer_81 hotmail.com> writes:
"_" <mjoyl lineone.netX> wrote in message
news:brm044$28jk$1 digitaldaemon.com...
 "grammer" <pgrammer_81 hotmail.com> wrote in message
 news:brlppd$1v8d$1 digitaldaemon.com...
 OK, I have the version 8.38 of the digitalmars compiler and version
2.4.2
 of
 wxwindows. I have not modified wxwindows in any way. I have used the
 makefiles provided for the symantec compiler (sc). Everything almost
works
 perfectly except for one thing. The compiler hiccoughs on fileconf.cpp.
This
 is the error msg:
-I..\../src/regex;..\../src/png;..\../src/jpeg;..\../src/zlib;..\../src/ti ff
 ..\..\src\common\fileconf.cpp -o..\..\src\common\fileconf.obj
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 ^
 ..\..\src\common\fileconf.cpp(1209) : Error: ambiguous reference to
symbol
 Had: wxLogTrace(char const *,...)
 and: wxLogTrace(char const *,char const *,...)
 --- errorlevel 1

 --- errorlevel 1
I too recently experienced that with 2.4.2... but not with 2.4.1 patched
for
 .dmc makefiles.... so in a totally cavaleer act of what the heck try
 anything once... I took the fileconf.cpp from 2.4.1 and dropped it in the
 2.4.2 tree and re-ran the make...
 it compiled and built the lib fine... no idea what problems i'll run into
 down the road but at least i can play for now. If I had a clue about C++
I'd
 probably have something constructive to add but i'm trying to use this to
 learn with so can't understand why just that pair throw up the error when
 the same style statements appear elsewhere in that file... or look like
they
 do to me. My intuition said compiler error and not an actual source file
 error.
The previous version of wxwindows that I have on hand is wxwindows-2.4.0. I checked it and the 2.4.0 fielconf.cpp has the same lines of code (written in the same way) that bothers the compiler when building the 2.4.2 version. However, when I substitute the 2.4.0 fileconf.cpp into the 2.4.2 source tree it compiles without error. Therefore, I suppose the problem is something trickier than just those two lines of code. So yeah, I'm just going to add that ifdef around the integer definition amd continue programming. Hopefully the problem will be gone in a future compiler version.
 And these are the offending lines of code:


     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );
     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 I assume the compiler is having problems disambiguating these overloaded
 function definitions from log.h (#included in fileconf.cpp)

 inline void wxLogTrace(const wxChar *, ...) { }
 inline void wxLogTrace(const wxChar *, const wxChar *, ...) { }

 Honestly, these overloads seem a little peculiar to me so I can
understand
 why the compiler might be confused. This is the strange part though.. If
I
 comment out any of the two function calls it compiles without complaint.
 Even more bizarre, it compiles without error if I place a line of code
 between the calls to wxLogTrace. For example:

     wxLogTrace( _T("wxFileConfig"),
                 _T("        head: %s"),
                 ((m_linesHead) ? m_linesHead->Text().c_str() :
 wxEmptyString) );

     int i = 0;

     wxLogTrace( _T("wxFileConfig"),
                 _T("        tail: %s"),
                 ((m_linesTail) ? m_linesTail->Text().c_str() :
 wxEmptyString) );

 Believe it or not, that compiles without error. I have been able to
build
 and use the library by utilizing that trick. However, I'm really curious
to
 know whether anyone else has experienced this and what a better fix
might
 be.
I prefer your workaround and will be recompiling the 2.4.2 file tomorrow with a similar inocuos statement inserted... maybe ifdef'd just for DMC
;-)
 BTW, I must say that dmc's compilation speeds are insane! I do mostly
 windows programming so I am in the process of switching from g++. BIG
 difference. Great work!
Dec 16 2003