program can not run on xp

2 views
Skip to first unread message

Sam Hu

unread,
Sep 17, 2008, 4:02:23 AM9/17/08
to eC Programming Language
Hi Jerome,

I tried the section Property in Dao and below is the program source:

//**********************************************************
import "ecere"

class Person
{
int age;
public:
property int age
{
get{return age;}
set
{
PrintLn("age(previously",age,") and now is ",value);
//printf("age(previous %d) and now is %d\n",value);
age=value;
}
}
}

int main()
{
Person Tom {age=20};
return 0;
}
//*************************************
The program compiled successfully,but when I run both by double click
on it and from the command line,the program crashed and xp threw a
exception saying that "We are sorry ......".

Regards,
Sam

Sam Hu

unread,
Sep 17, 2008, 4:12:10 AM9/17/08
to eC Programming Language
I revised the source as below:

//**********************************
import "ecere"

class Person
{
int age;
public:
property int age
{
get{return age;}
set
{
PrintLn("age(previously",age,") and now is ",value);
printf("age(previous %d) and now is %d\n",value);
age=value;
}
}
}
class App:Application
{
void main()
{
Person Tom {age=20};
Tom.age+=2;
PrintLn("Tom now is ",Tom.age);
system("PAUSE");

//return 0;
}
//******************************8
This time no exception thrown by xp,but nothing happened.No any
output.

Regards,
Sam

Jerome St-Louis

unread,
Sep 17, 2008, 9:52:04 AM9/17/08
to ec-programm...@googlegroups.com
Hi Sam,

In eC, the proper entry point is the Main() function of the Application class.

You should not define a function main() in eC.

If you replace your main() function by the following it will work.

class TestApp : Application
{
   void Main()
   {
     Person Tom {age=20};
     return 0;
   }
}

Regards,

Jerome

Sam Hu

unread,
Sep 17, 2008, 8:35:25 PM9/17/08
to eC Programming Language
Hi Jerome,

Now I revised the program as below,the app now can run ,but just a
single line "Press any key to continue...",after my press a key,the
app exit.That'is all.

//***************************************************
import "ecere"

class Person
{
int age;
public:
property int age
{
get{return age;}
set
{
printf("age(previous %d) and now is %d\n",value);
age=value;
}
}
}
class TestApp:Application
{
void Main()
{
Person Tom {age=20};
Tom.age=40;
printf("Tom now is %d\n",Tom.age);
system("PAUSE");

}
}
//************************************

Jerome St-Louis

unread,
Sep 17, 2008, 9:22:01 PM9/17/08
to ec-programm...@googlegroups.com
Hi Sam,

This is on Windows?
Have you checked "Console Application" in the Project settings (Alt-F7) ?

Jerome

Sam Hu

unread,
Sep 17, 2008, 9:34:39 PM9/17/08
to eC Programming Language
Hi Jerome,

Ah~,now it works fine,and I can continue.-:)

Thanks,
Sam
Reply all
Reply to author
Forward
0 new messages