Unresolved entry point: MAMain

15 posts / 0 new
Last post
insert
insert's picture
Offline
Joined: 3 May 2011
Posts:
Unresolved entry point: MAMain

Unresolved entry point: MAMain
crtlib.s:1: Error: Exiting with user error,

i have checked some of the forum post they say u have to include the library in the build settings but i aready done so but it still showing this error. Been looking around for a help related to this problem but could not find thus unable to resolve . Anyone is kind enough to help me to solve this problem?

THANKS
REGARDS,
INSERT

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Diego Velazquez
diegolv's picture
Offline
Mobile Wizard
Joined: 4 Oct 2010
Posts:

Hi,

Try creating a new project using Wizard. Then, compare the new one with this.

Regards,

Diego

insert
insert's picture
Offline
Joined: 3 May 2011
Posts:

i have done so. but now i compile and run the emulator does not show anything (black screen)
and this is wat is written and the console.

[10] Emulator connected.
[10] IP:0x1c236: crtlib.s:1
[10] IP:0x404: C:/MoSync/workspace/UTest/main.cpp:30
[10] IP:0x2b214: c:/mb/mosync-trunk/libs/MAUtil/Moblet.cpp:79
[10] IP:0x24f82: c:/mb/mosync-trunk/libs/MAUtil/Environment.cpp:318
[10] IP:0x2a9e5: c:/mb/mosync-trunk/libs/MAUtil/Moblet.cpp:49
[10] IP:0x2a9f3: c:/mb/mosync-trunk/libs/MAUtil/Moblet.cpp:141
[10] IP:0x2a9d3: c:/mb/mosync-trunk/libs/MAUtil/Moblet.h:145
[10] Exit @ IP 0x2a9d1 SP 0x1fff70
[10] IP:0x2a9d1: c:/mb/mosync-trunk/libs/MAUtil/Moblet.cpp:145

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

What should it do?

insert
insert's picture
Offline
Joined: 3 May 2011
Posts:

it should show questions that got multiple answer. but now is just showing black screen.

i just tried to delete away main.cpp than it goes back to my 1st error.
but when i put the main.cpp but my main is at another screen so how do i make sure that the screen (my main not main.cpp) will be requested to display at 1st page?

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

If you're working off MAUIex, then deleting main.cpp will also delete the MAmain() function, so I'm not surprised your getting that message. In C and C++, all programs start by running a function called 'main'. In MoSync, this is actually called MAMain. In MAMain it creates and runs an instance of the Moblet object. The moblet constructor has a line like:

MainScreen* mainScreen = new MainScreen();
mainScreen->show();

You need to replace these lines with ones which show your screen.

Diego Velazquez
diegolv's picture
Offline
Mobile Wizard
Joined: 4 Oct 2010
Posts:

Sam,

don't forget the debugger problem. If you place a breakpoint and then edit the code, sometimes it runs the app and exits. Insert, try removing all breakpoints.

Diego

insert
insert's picture
Offline
Joined: 3 May 2011
Posts:

Still unable to solve it. Tried removing aready

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

I think we probably need to see the contents of your main.cpp. Can you paste the source into here? What you should probably have is a file called main.cpp which has a function called MAMain() which looks something like this:

extern "C" int MAMain()
{
	Moblet::run(new MyMoblet());
	return 0;
};

Which will start your app, and your Moblet code will create and show the first screen

MyMoblet::MyMoblet()
{
  Screen* myScreen = new MyScreen();
  myScreen->show();
}

Abi Waqas
abi's picture
Offline
Mobile Wizard
Joined: 3 May 2010
Posts:
diegolv wrote:

Sam,

don't forget the debugger problem. If you place a breakpoint and then edit the code, sometimes it runs the app and exits. Insert, try removing all breakpoints.

Diego

Hi Diego,

I was reading this conversation today and found your aforementioned comment. Interesting, would you like to explain it a bit more. I am already trying to reproduce and look into it. Our utmost desire it to provide you guys with a bug-free debugger. And for that, we for sure require your help. Provide me with some more details if you can and we will try to fix it asap.

Enjoy a nice summer.
Abi Waqas

workhard
workhard's picture
Offline
Mobile Conjurer
Joined: 3 May 2011
Posts:
#include <MAUtil/Moblet.h>
#include <MAUI/Screen.h>
#include <MAUI/Label.h>

#include "QuizMoblet.h"
#include "ResourceParser.h"
#include "../../Log.h"
#include "MAHeaders.h"



namespace Quiz{

QuizMoblet *QuizMoblet::mInstance = NULL;

QuizMoblet::QuizMoblet():mThemeScreen(NULL)
{
		  MAExtent screenSize = maGetScrSize();
		  int scrWidth = EXTENT_X(screenSize);
		  int scrHeight = EXTENT_Y(screenSize);
		  mThemeScreen = new ThemeScreen(scrWidth, scrHeight);
		  loadThemes();
		  mThemeScreen->show();
}

QuizMoblet *QuizMoblet::getInstance()
{
	if( NULL == mInstance )
		mInstance = new QuizMoblet();
	return mInstance;
}

void QuizMoblet::loadThemes()
{
	if(NULL == mThemeScreen)
		return;

	ResParser::getInstance().setStartID(RES_THEMES);

	MAUtil::Vector<MAUtil::String> themes;
	ResParser::getInstance().getThemesName(themes);

	for(int i=0; i<themes.size(); ++i)
	{
		mThemeScreen->add(themes[i]);
	}
}

QuizMoblet::~QuizMoblet() {
		delete mThemeScreen;
}

}
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hey workhard, I'm not sure why you've posted this code? Are you having this problem? If so, then there are two things you need to do - have a file called main.cpp with a method called MAMain(). All MoSync programs start by calling MAMain(), always.

extern "C" int MAMain()
{
    Moblet::run(new QuizMoblet());
    return 0;
};

Secondly, you don't need to make QuizMoblet a singleton, the Moblet::run static method will invoke a single instance of the moblet and execute the constructor.

workhard
workhard's picture
Offline
Mobile Conjurer
Joined: 3 May 2011
Posts:

hello sam, i create a main.cpp and input the following code u given me above it does not work saying " QuizMoblet has not been declared "

i put the code in the QuizMoblet.cpp because i do not have a main.cpp and i create one but it will show the same error as QuizMoblet

To verify iszit always a moblet file ( file that contain moblet ) that is the first page of the program? because that when u input MAMain() which run always at the first place when the program run?

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi workhard, moblet is one way of creating an app in MoSync. If you are using C++, then it is definitely the recommended option as there are a lot of work done handing device resources.

If you are writing in C, then you don't have to use moblet at all.
Either way (in C or C++) you need an MAMain() function. For your quiz app, you need to create the MAMain() function to create the moblet.

It sounds like you need to add the headers for QuizMoblet to the main.cpp file.

#include <MAUtil/Moblet.h>
#include "QuizMoblet.h"
using namespace MAUtil;
extern "C" int MAMain()
{
    Moblet::run(new QuizMoblet());
    return 0;
};

workhard
workhard's picture
Offline
Mobile Conjurer
Joined: 3 May 2011
Posts:

hi sam , after adding the codes u given me to the main.cpp

i still having the same error

'QuizMoblet' has not been declared .