TexGenGui without main procedure?

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
sprobst76
Posts: 7
Joined: Thu Jul 02, 2009 7:09 am

TexGenGui without main procedure?

Post by sprobst76 »

Hi all,

as I mentioned in the previous thread already I try to compile TexGen by myself on Windows. I skipped to try it with python 3.x and gone back to 2.6.2.

I can compile the full project with Visual C++ and can also start the "Install" procedure. But the resulting TexGenGui.exe can not be started at all. I wanted to debug it with error messages but have not found any int main(...) procedure within the TexGenGui files. Now I am confused because I have no idea how a runnable application can be created without a main procedure. Perhaps anybody can help me with this problem. It can also be that I have overlooked something!?

Best regards
Stefan
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

Hi Stefan,

Sticking with Python 2.6.2 was probably a good idea. I think you could run into all kinds of problems with Python 3.x.

Regarding the main procedure (from http://docs.wxwidgets.org/stable/wx_wxappoverview.html):
A wxWidgets application does not have a main procedure; the equivalent is the OnInit member defined for a class derived from wxApp. OnInit will usually create a top window as a bare minimum.
You can find that in TexGenApp.cpp.

I'm not sure that will help you though, I noticed a problem when compiling TexGen GUI with MSVC 2005 and 2008. The application seemed to throw an error and exit before I was even able to attach the debugger to it and put a breakpoint. I only noticed this issue about a week before I left the Composites group at Nottingham and wasn't able to find a solution to it at that time. Sorry about that, you will probably have more luck with MSVC 2003.

Regards,

Martin.
sprobst76
Posts: 7
Joined: Thu Jul 02, 2009 7:09 am

Post by sprobst76 »

Hi Martin,

I seem to have the same Problem as you had before you left the Composite group.

I even tried to replace the OnInit procedure:
bool CTexGenApp::OnInit()
{
/*SetAppName(wxT("TexGen"));

wxConfigBase::Set(wxConfigBase::Create());

wxXmlResource::Get()->InitAllHandlers();
wxXmlResource::Get()->Load(wxStandardPaths::Get().GetDataDir() + wxT("/TexGen.xrc"));

m_pMainFrame = new CTexGenMainFrame(wxT("TexGen"), wxDefaultPosition, wxSize(500,450));
m_pMainFrame->Show(TRUE);
m_pMainFrame->OnInit();

SetTopWindow(m_pMainFrame);

return wxApp::OnInit();*/
wxFrame *the_frame = new wxFrame(NULL, -1, "Test",wxPoint(50,50),wxSize(50,50));

the_frame->Show(true);
SetTopWindow(the_frame);

return true;


}
But as I also expected I did not help at all. Probably there is some error in the initialization process even before the OnInit procedure can be called. I am not sure how to get rid of the problem, but I will try.

Perhaps you have an idea.

Thank you again for the answer!

Regards
Stefan
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

sprobst76 wrote:Probably there is some error in the initialization process even before the OnInit procedure can be called.
Yes I think that's right. I suspect the problem actually occurs in the wxWidgets code, I think it is responsible for declaring the entry point for the application. Maybe the best way to sort the problem out is to get a debug build of wxWidgets and debug it. Maybe I have done something wrong in the CTexGenApp class causing it to crash. It's all a bit strange and had me quite stumped at the time.

Might be worth just commenting out the whole CTexGenApp class and replacing it with some sample wxWidgets code (http://www.wxwidgets.org/docs/tutorials/hello.htm) to see if you can get the application to start running without crashing. Or even just this:

int main()
{

}

It's the IMPLEMENT_APP(CTexGenApp) macro which actually creates the main function looking at the hello world tutorial. I'd try it myself but I don't have a buildable version of TexGen set up here.
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Post by louisepb »

Hi Stefan,

I now have a working VS2008 build on my machine. It would seem to be a manifest problem.

You need to open the properties window of the TexGenGUI project and then change the Configuration Properties->Manifest Tools-> Input and Output->Embed Manifest property to 'No'.

You also need to add comctl32.lib and rpcrt4.lib to Linker->Additional Dependencies. In due course I will add these to the appropriate CMake file in the repository but at the moment am waiting to be given access to be able to commit changes.

If you run the executable from a different folder from the one in which it was built then you will need to copy TexGenGUI.exe.manifest into the same folder. You may also need to copy msvcp90.dll and msvcr90.dll from your VS installation (I guess that these need including in the installer but I haven't got that far yet! )

Hope that helps. I'm still feeling my way along so I may well have forgotten something - if you have problems get back to me and I'll see if I can help.

Best regards,

Louise
Post Reply