I''ve gotten a lot farther building wxRuby than I did a few months ago. But its getting late here and I''m going to bed. In the meantime, does anyone know why I''m getting this compile error: Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. cl -MD -Zi -O2b2xg- -G6 -ID:\Dev\RubyDev\wxWindows-2.4.1/include -ID:\Dev\Ru byDev\wxWindows-2.4.1/lib/mswd -DSTRICT -DWIN32 -D__WXMSW__ -I. -Ic:/ruby/ lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -I. -I./. . -I./../missing -c -Tpwx.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. wx.cpp cl -MD -Zi -O2b2xg- -G6 -ID:\Dev\RubyDev\wxWindows-2.4.1/include -ID:\Dev\Ru byDev\wxWindows-2.4.1/lib/mswd -DSTRICT -DWIN32 -D__WXMSW__ -I. -Ic:/ruby/ lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -I. -I./. . -I./../missing -c -Tpapp.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. app.cpp app.cpp(181) : error C2039: ''GetClassNameA'' : is not a member of ''wxAppWithCallbacks'' app_cb.h(16) : see declaration of ''wxAppWithCallbacks'' NMAKE : fatal error U1077: ''cl'' : return code ''0x2'' Stop. Error executing nmake. wxruby.so - 2 error(s), 0 warning(s) Thanks, Curt
Curt Hibbs wrote:> I''ve gotten a lot farther building wxRuby than I did a few months ago. But > its getting late here and I''m going to bed. > > In the meantime, does anyone know why I''m getting this compile error: > > Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86 > Copyright (C) Microsoft Corp 1984-1998. All rights reserved. > app.cpp > app.cpp(181) : error C2039: ''GetClassNameA'' : is not a member of > ''wxAppWithCallbacks'' > app_cb.h(16) : see declaration of ''wxAppWithCallbacks'' > NMAKE : fatal error U1077: ''cl'' : return code ''0x2''Hmmm. It seems that wxWindows defines a GetClassName method, but MS Windows also has such a method. In windows.h, GetClassName is being defined to be GetClassNameA (the Ascii version of that call, as opposed to the Wide (unicode) character version). Try inserting this near the top of our wx.h, right after the #include "wx/wx.h": #undef GetClassName Assuming that works, there may be a few others that will need to be added, following the same pattern: GetClassInfo, DrawText, GetCharWidth, StartDoc, FindWindow, and FindResource. Kevin
Kevin Smith [mailto:wxRuby@qualitycode.com]> > Curt Hibbs wrote: > > I''ve gotten a lot farther building wxRuby than I did a few > months ago. But > > its getting late here and I''m going to bed. > > > > In the meantime, does anyone know why I''m getting this compile error: > > > > Microsoft (R) 32-bit C/C++ Optimizing Compiler Version > 12.00.8804 for 80x86 > > Copyright (C) Microsoft Corp 1984-1998. All rights reserved. > > app.cpp > > app.cpp(181) : error C2039: ''GetClassNameA'' : is not a member of > > ''wxAppWithCallbacks'' > > app_cb.h(16) : see declaration of ''wxAppWithCallbacks'' > > NMAKE : fatal error U1077: ''cl'' : return code ''0x2'' > > Hmmm. It seems that wxWindows defines a GetClassName method, but MS > Windows also has such a method. In windows.h, GetClassName is being > defined to be GetClassNameA (the Ascii version of that call, as opposed > to the Wide (unicode) character version). > > Try inserting this near the top of our wx.h, right after the #include > "wx/wx.h": > > #undef GetClassName > > Assuming that works, there may be a few others that will need to be > added, following the same pattern: GetClassInfo, DrawText, GetCharWidth, > StartDoc, FindWindow, and FindResource.No, that''s not it (I did try the undef, but hat didn''t help). Its actually complaining that GetClassName does not exist as a member of the class wxAppWithCallbacks. It should exist, of course, because it is derived from wxApp which is (in turn) derived from wxAppBase, and GetClassName is defined in wxAppBase. It possibly has something to do with the name mangling it is doing to add the "A" suffix, but if so the compiler should do the same mangling when processing the wxApp.h header file. I''ll keep looking. Curt PS I also tried rebuilding wxWindows as a shared library since Gour reported he had problems with a static build. I didn''t really expect that to change anything since doing that should only affect link problems, not compile problems, and I was right -- that didn''t help either.
Curt Hibbs wrote:>>>Copyright (C) Microsoft Corp 1984-1998. All rights reserved. >>>app.cpp >>>app.cpp(181) : error C2039: ''GetClassNameA'' : is not a member of> Its actually complaining that GetClassName does not exist as a member of the > class wxAppWithCallbacks. It should exist, of course, because it is derived > from wxApp which is (in turn) derived from wxAppBase, and GetClassName is > defined in wxAppBase. > > It possibly has something to do with the name mangling it is doing to add > the "A" suffix, but if so the compiler should do the same mangling when > processing the wxApp.h header file.I really, really, really think this has to do with a header defining GetClassName to be GetClassNameA. If I remember correctly, that''s the way MS was able to have both Ascii (Win 95) and Unicode (Win NT) support in the same code base. It seems that wxApp *does* have GetClassName, but for some reason in app.cpp it is looking for GetClassNameA instead. You could try inserting the #undef GetClassName on line 180 of app.cpp to see if that changes the behavior. Kevin
Hi Kevin, You and I met a few times at the now dormant Bay Area Ruby User''s meetings. I''m glad to see the progress you''re making on wxRuby. You''re right about this error being caused by the file "..Microsoft Visual Studio/VC98/INCLUDE/winuser.h" doing #define GetClassName GetClassNameW OR #define GetClassName GetClassNameA I''m a bit too snowed under to take a careful look at this right now (for example, I''m at work today (Sunday)), but I did just now grab the wxruby 0.1.0 .tgz file from your web site and tried to compile app.cpp. I did get the error ...\app.cpp(176) : error C2039: ''GetClassNameA'' : is not a member of ''wxAppWithCallbacks'' ...\app_cb.h(16) : see declaration of ''wxAppWithCallbacks'' (I also got a few other errors, so apparently there is newer source in CVS.) Your suggestion to include the line #undef GetClassName caused the above error to go away, but I did have to put this line at the top of app.h (rather than in app.cpp), since "GetClassName" also appears in app.h. Hope this helps, Wayne No Bugs Software "Ruby and C++ Contract Programming in Silicon Valley" Sunday, October 26, 2003, 2:13:11 PM, you wrote: KS> Curt Hibbs wrote:>>>>Copyright (C) Microsoft Corp 1984-1998. All rights reserved. >>>>app.cpp >>>>app.cpp(181) : error C2039: ''GetClassNameA'' : is not a member of>> Its actually complaining that GetClassName does not exist as a member of the >> class wxAppWithCallbacks. It should exist, of course, because it is derived >> from wxApp which is (in turn) derived from wxAppBase, and GetClassName is >> defined in wxAppBase. >> >> It possibly has something to do with the name mangling it is doing to add >> the "A" suffix, but if so the compiler should do the same mangling when >> processing the wxApp.h header file.KS> I really, really, really think this has to do with a header defining KS> GetClassName to be GetClassNameA. If I remember correctly, that''s the KS> way MS was able to have both Ascii (Win 95) and Unicode (Win NT) support KS> in the same code base. KS> It seems that wxApp *does* have GetClassName, but for some reason in KS> app.cpp it is looking for GetClassNameA instead. You could try inserting KS> the #undef GetClassName on line 180 of app.cpp to see if that changes KS> the behavior. KS> Kevin KS> _______________________________________________ KS> wxruby-users mailing list KS> wxruby-users@rubyforge.org KS> http://rubyforge.org/mailman/listinfo/wxruby-users
Wayne Vucenic wrote:> > Your suggestion to include the line > > #undef GetClassName > > caused the above error to go away, but I did have to put this > line at the top > of app.h (rather than in app.cpp), since "GetClassName" also appears > in app.h. > > Hope this helps,That must have been my problem, I put it in app.cpp. Thanks for the advice, I''ll move it to app.h! Curt
Curt Hibbs wrote:> > Wayne Vucenic wrote: > > > > Your suggestion to include the line > > > > #undef GetClassName > > > > caused the above error to go away, but I did have to put this > > line at the top > > of app.h (rather than in app.cpp), since "GetClassName" also appears > > in app.h. > > > > Hope this helps, > > That must have been my problem, I put it in app.cpp. Thanks for > the advice, > I''ll move it to app.h!That did it!!! Now I''m getting similar errors that Kevin suspected would also occur, but now that I know what''s going on it should be no problem to fix these as well. Curt
It turns out the right place to put the #undefs for windows *is* in our "wx.h", but it has to go after the include of "ruby.h" not merely after the include of "wx/wx.h". Curt Curt Hibbs wrote:> > Curt Hibbs wrote: > > > > Wayne Vucenic wrote: > > > > > > Your suggestion to include the line > > > > > > #undef GetClassName > > > > > > caused the above error to go away, but I did have to put this > > > line at the top > > > of app.h (rather than in app.cpp), since "GetClassName" also appears > > > in app.h. > > > > > > Hope this helps, > > > > That must have been my problem, I put it in app.cpp. Thanks for > > the advice, > > I''ll move it to app.h! > > That did it!!! > > Now I''m getting similar errors that Kevin suspected would also > occur, but now that I know what''s going on it should be no > problem to fix these as well. > > Curt
Curt Hibbs wrote:> It turns out the right place to put the #undefs for windows *is* in our > "wx.h", but it has to go after the include of "ruby.h" not merely after the > include of "wx/wx.h".Ah! The problem wasn''t that wx was including windows.h (which #defined GetClassName). It was that _ruby_ was including windows.h. Now it makes sense. The nice thing is that the #undefs will be benign on all platforms, so we won''t even need #ifdef''s or an extconf.rb change to fix it. Good work! Kevin
Kevin Smith wrote:> > Curt Hibbs wrote: > > It turns out the right place to put the #undefs for windows *is* in our > > "wx.h", but it has to go after the include of "ruby.h" not > merely after the > > include of "wx/wx.h". > > Ah! The problem wasn''t that wx was including windows.h (which #defined > GetClassName). It was that _ruby_ was including windows.h. Now it makes > sense. > > The nice thing is that the #undefs will be benign on all platforms, so > we won''t even need #ifdef''s or an extconf.rb change to fix it.I used #ifdef anyway because it makes it clearer why the #undefs are there. Curt