Hello
Everytime that i've tried to run the following program i got a run-time
error:
#include <wx\wx.h>
int main(int argc, char **argv)
{
wxMessageBox("Hello!");
return 0;
}
No Error during compiling and linking time, but i've a crash every time
that i try to rum the application. I've used dev-cpp and mingw developer
studio but the result is the same.
What's the problem?
Problem compiling a WXwidgets application Topic is solved
I am not sure such a source code would work.
You should look at the samples delivered with wxWidgets ("samples" directory), especially the "minimal" one.
Now, regarding wether you wish to test a GUI or command line app, the code will be different... (precompiler directives, macro to instanciate the app, ...).
You should not need to write a "main (argc, argv)" function, unless you really have specific requirements with your app.
You should look at the samples delivered with wxWidgets ("samples" directory), especially the "minimal" one.
Now, regarding wether you wish to test a GUI or command line app, the code will be different... (precompiler directives, macro to instanciate the app, ...).
You should not need to write a "main (argc, argv)" function, unless you really have specific requirements with your app.
this works,
build it as console application with macro defined
brgds
Code: Select all
//headers & declarations
#include <wx/wx.h>
#include <stdio.h>
//"console" like main
int xxmain(int argc, char** argv)
{
printf(" %3d : %s \n", argc, argv[0]);
wxMessageBox(argv[0]);
return argc+20;
}
//wxapp
class MyApp: public wxApp
{
virtual int OnRun();
};
IMPLEMENT_APP(MyApp)
int MyApp::OnRun()
{
return xxmain(argc, argv);
}
Code: Select all
wxUSE_GUI=1
brgds
-tiwag