getting this error. Please help me..

3 posts / 0 new
Last post
workhard
workhard's picture
Offline
Mobile Conjurer
Joined: 3 May 2011
Posts:
getting this error. Please help me..
#include <MAUtil/Moblet.h>
#include <MAUI/Screen.h>
#include <MAUI/Label.h>
#include <conprint.h>
using namespace MAUtil;
using namespace MAUI;



class MyScreen : public Screen {
public:
	MyScreen() {

	}
	
	~MyScreen() {
		// todo: delete main widget of this screen 
	}
private:
};

class MAUIMoblet : public Moblet {
public:
	MAUIMoblet() {
		// initialize
		screen = new MyScreen();
		screen->show();
	}

	void keyPressEvent(int keyCode, int nativeCode) {
		// todo: handle key presses
	}

	void keyReleaseEvent(int keyCode, int nativeCode) {
		// todo: handle key releases
	}
	MyScreen* screen;

	~MAUIMoblet() {
		delete screen;
	}
	
};

typedef struct
{
	char *name;
	char *popn;
}City;

extern "C" int MAMain() {
	Moblet::run(new MAUIMoblet());

	City ny,la,ch,*ptr;
					ny.name = "New York City";
					ny.popn = "8,888,888";
					printf("\n%s,Population:%s\n",ny.name,ny.popn);

					ptr = &la;
					ptr->name = "Los Angeles";
					ptr->popn = "3,333,333";
					printf("\n%s,Population:%s\n",la.name,la.popn);

					ptr = &ch;
					ptr->name = "Chicago";
					ptr->popn = "1,111,111";
					printf("\n%s,Population:%s\n",ptr->name,ptr->popn);

					return 0;
					};



I keep getting this error message. Symbol '_MAMain' is already defined

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hmm, dunno, except that this isn't really going to work very well anyway. You're creating a Moblet (for event-based C++ development), but carrying on with some C code in MAMain. You're much better off creating a new project and selecting 'MoSync C Project' as a template and using this code (I've just run and retested this)

#include <ma.h>
typedef struct
{
	char *name;
	char *popn;
}City;
int MAMain()
{
	City ny,la,ch,*ptr;
	ny.name = "New York City";
	ny.popn = "8,888,888";
	printf("\n%s,Population:%s\n",ny.name,ny.popn);
	ptr = &la;
	ptr->name = "Los Angeles";
	ptr->popn = "3,333,333";
	printf("\n%s,Population:%s\n",la.name,la.popn);
	ptr = &ch;
	ptr->name = "Chicago";
	ptr->popn = "1,111,111";
	printf("\n%s,Population:%s\n",ptr->name,ptr->popn);
	return 0;
};

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

but i cannot use c project as my project so any thing i can do to make it usable in MAUI?