wx terminate my program? core dump after calling SetMenuBar
wx terminate my program? core dump after calling SetMenuBar
Hello,
i created my first wx Application yesterday, but there is a problem. There's no compiling or linking errors, but after calling SetMenuBar in the constructor of my TopLevelFrame class ( it's derived from wxFrame ) the programm will be terminated.
I've no idea that the reson could be. I have build the wx libs over the night again. With the static libs there are no problem to build. Here some additional hints for helping me: I am using the Debug libaries with unicode support. The Application is nothing more than a Hello World.
Thanks for Help.
i created my first wx Application yesterday, but there is a problem. There's no compiling or linking errors, but after calling SetMenuBar in the constructor of my TopLevelFrame class ( it's derived from wxFrame ) the programm will be terminated.
I've no idea that the reson could be. I have build the wx libs over the night again. With the static libs there are no problem to build. Here some additional hints for helping me: I am using the Debug libaries with unicode support. The Application is nothing more than a Hello World.
Thanks for Help.
Google is your friendfluxy wrote:I know how to use the debugger, i am sure. I think I not know that a backtrace is, because I am German. Maybe I only could not translate this word.
http://www.linux.com/howtos/Caudium-HOW ... race.shtml
Oh i see, you mean a function calling stack....
I can't show you that from the orginal project. But i created a new project, where i get the same problems. Here it is:
I can't show you that from the orginal project. But i created a new project, where i get the same problems. Here it is:
> foo.exe!wxStringData::IsValid() Zeile 249 + 0x28 Bytes C++
foo.exe!wxStringBase::operator=(const wxStringBase & stringSrc={...}) Zeile 775 + 0xf Bytes C++
foo.exe!wxString::operator=(const wxString & __that={...}) + 0x2f Bytes C++
foo.exe!wxWindowBase::SetName(const wxString & name={...}) Zeile 182 + 0x35 Bytes C++
foo.exe!wxStatusBar::Create(wxWindow * parent=0x00d74cf0, int id=1243816, long style=14109936, const wxString & name={...}) Zeile 71 + 0x13 Bytes C++
foo.exe!wxStatusBar::wxStatusBar(wxWindow * parent=0x00d74cf0, int id=1243816, long style=14109936, const wxString & name={...}) Zeile 28 C++
foo.exe!wxFrame::OnCreateStatusBar(int number=1243412, long style=14109936, int id=1243816, const wxString & name={...}) Zeile 341 + 0x35 Bytes C++
foo.exe!wxFrameBase::SetMenuBar(wxMenuBar * menubar=0x00d813e0) Zeile 565 + 0x12 Bytes C++
foo.exe!FooFrame::FooFrame(const wxString & title={...}, const wxPoint & pos={...}, const wxSize & size={...}) Zeile 24 C++
foo.exe!FooApp::OnInit() Zeile 10 + 0x7e Bytes C++
foo.exe!wxAppConsole::CallOnInit() Zeile 76 + 0x32 Bytes C++
foo.exe!wxEntryReal(int & argc=1, wchar_t * * argv=0x00d72a70) Zeile 424 + 0x1d Bytes C++
foo.exe!wxEntry(int & argc=1, wchar_t * * argv=0x00d72a70) Zeile 208 + 0xd Bytes C++
foo.exe!wxEntry(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, HINSTANCE__ * __formal=0x00000000, int nCmdShow=1) Zeile 385 + 0xd Bytes C++
foo.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151efe, int nCmdShow=1) Zeile 5 + 0x33 Bytes C++
foo.exe!__tmainCRTStartup() Zeile 578 + 0x35 Bytes C
foo.exe!WinMainCRTStartup() Zeile 403 C
kernel32.dll!7c816fd7()
Here some new informations. The programm was compiled in unicode mode. That means that i am using the unicode libs of wx and I already compiled the project in unicode mode.
If I don't use the unicode libraries, there are another error. The linker could not find the information for one method of wx:
wxmsw28d_core.lib(appcmn.obj) : error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ)
D:\Source\foo\foo_ansi\foo.exe : fatal error LNK1120: 1 unresolved externals
Could anyone tell me whats going wrong on both cases?
If I don't use the unicode libraries, there are another error. The linker could not find the information for one method of wx:
wxmsw28d_core.lib(appcmn.obj) : error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ)
D:\Source\foo\foo_ansi\foo.exe : fatal error LNK1120: 1 unresolved externals
Could anyone tell me whats going wrong on both cases?
sure. i will post all the code and project settings here.
I seperated header and source definitions, so there are at least 4 files i will post. The first ones are the header files.
Header of FooApp ( fooApp.h ):
Then the header of the FooFrame class (fooFrame.h)
Well, thats all classes I created myself. In the fooApp.cpp only the OnInit is implemented:
And the FooFrame implementation:
Some usefull project settings (posted from the vcproj-file)
On Unicode Mode the libs which are included are
So I think thats all important informations about it.
I seperated header and source definitions, so there are at least 4 files i will post. The first ones are the header files.
Header of FooApp ( fooApp.h ):
Code: Select all
#ifndef FOO_APP_H
#define FOO_APP_H
class FooApp : public wxApp
{
public:
virtual bool OnInit (void);
private:
protected:
};
#endif
Code: Select all
#ifndef FOO_WIDGET_H
#define FOO_WIDGET_H
enum
{
ID_QUIT = 1001,
ID_ABOUT = 1002,
};
class FooFrame : public wxFrame
{
public:
FooFrame ( const wxString& title, const wxPoint& pos, const wxSize& size );
void OnQuit (wxCommandEvent& WXUNUSED(event));
void OnAbout (wxCommandEvent& WXUNUSED(event));
private:
protected:
DECLARE_EVENT_TABLE()
};
#endif
Code: Select all
#include "wx/wx.h"
#include "FooApp.h"
#include "FooFrame.h"
IMPLEMENT_APP ( FooApp )
bool FooApp::OnInit()
{
FooFrame* pFoo = new FooFrame ( wxT ( "OrgaClient" ), wxPoint(50,50), wxSize(450,340));
pFoo->Show ( TRUE );
SetTopWindow ( pFoo );
return TRUE;
}
Code: Select all
#include "wx/wx.h"
#include "FooFrame.h"
BEGIN_EVENT_TABLE ( FooFrame, wxFrame )
EVT_MENU ( ID_QUIT, FooFrame::OnQuit )
EVT_MENU ( ID_ABOUT, FooFrame::OnAbout )
END_EVENT_TABLE ()
FooFrame::FooFrame ( const wxString& title, const wxPoint& pos, const wxSize& size )
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_ABOUT, wxT ("&About...") );
menuFile->AppendSeparator();
menuFile->Append( ID_QUIT, wxT ("E&xit") );
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, wxT ("&File" ) );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( wxT ("Welcome to wxWindows!") );
}
void FooFrame::OnQuit (wxCommandEvent& WXUNUSED(event))
{
// At the moment there are no event handling
}
void FooFrame::OnAbout (wxCommandEvent& WXUNUSED(event))
{
// At the moment there are no event handling
}
Some usefull project settings (posted from the vcproj-file)
Code: Select all
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="E:\wx\lib\vc_lib\mswunivud"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0400;wxUSE_GUI=1;__WXDEBUG__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
On Ansi Mode it looks like this:<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib wxpngd.lib wxzlibd.lib wxjpegd.lib wxtiffd.lib wxmsw28ud_core.lib wxbase28ud.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
Both configurations are build with CodeGeneration on Debug-Multithreaded Dll.<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib wxpngd.lib wxzlibd.lib wxjpegd.lib wxtiffd.lib wxmsw28d_core.lib wxbase28d.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
So I think thats all important informations about it.
Okay, it runs fine with my ANSI static non-debug wxMac libs. So it's either something with wxMSW or something in your configuration.
This is just a guess, but Unicode is often responsible for configuration problems. Can you try ANSI just to verify?
Also, several wxWidgets samples use menus. Can you see if these camples work?
This is just a guess, but Unicode is often responsible for configuration problems. Can you try ANSI just to verify?
Also, several wxWidgets samples use menus. Can you see if these camples work?
I just tried it with the menu sample. There are 16 configurations regarding to this project, so i completed rebuild all of them. 15 configurations are build fine, but in the Debug configuration (not in the unicode debug) there are the same error i get in my non-unicode project:
Lining...
wxmsw28d_core.lib(appcmn.obj) : error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ)
vc_mswd\menu.exe : fatal error LNK1120: 1 unresolved externals
//edit: the configurations which are build (that means all excluding the one with the linker error) are working fine.... i am confused...
Lining...
wxmsw28d_core.lib(appcmn.obj) : error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ)
vc_mswd\menu.exe : fatal error LNK1120: 1 unresolved externals
//edit: the configurations which are build (that means all excluding the one with the linker error) are working fine.... i am confused...
Can you rephrase that? It doesn't sound to clear to me what you meanfluxy wrote:I just tried it with the menu sample. There are 16 configurations regarding to this project, so i completed rebuild all of them. 15 configurations are build fine, but in the Debug configuration (not in the unicode debug) there are the same error i get in my non-unicode project:
Lining...
wxmsw28d_core.lib(appcmn.obj) : error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ)
vc_mswd\menu.exe : fatal error LNK1120: 1 unresolved externals
//edit: the configurations which are build (that means all excluding the one with the linker error) are working fine.... i am confused...
Do yo umean you built 16 different configurations for the sample and all work but one?
that's what i want to phrase?fluxy wrote:that's that i what to phrase
Okay - i can't tell you exactly why this particular one fails, maybe someone else can help you. But... out the 15 configurations, not a single one suits your need?
After all, you don't absolutely need a debug version since you're not going to program wxWidgets itself
EDIT: But apart from building, do the menus work without crashing there? that's what i wanted to check in the first place when asking you to build the samples