Help

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
soetanmike
Posts: 3
Joined: 12 Mar 2011 09:54

Help

#1 Post by soetanmike » 12 Mar 2011 10:29

hi every one, i am having a challenge i don't understand...am having this error message " main function is not defined "
error in PIC programming in C. after compiling my code...would be grateful if i can find a solution to this challenge
thanks

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Help

#2 Post by tihomir.losic » 14 Mar 2011 11:01

Hello,

you need to add source file (.c) to your project. Right click on folder "Sources", and then "Add file" (look at attachment):
Add_File.PNG
Add_File.PNG (20.9 KiB) Viewed 2729 times
Best regards,

Losic Tihomir
mikroElektronika [Support team]

cernek
Posts: 3
Joined: 21 Aug 2010 15:29

Re: Help

#3 Post by cernek » 22 Jun 2011 06:20

I am having (I believe) a related problem. When I open a Project using "Recent Projects" (I haven't tried any other way) the source file is not part of the project - I have to add it to the Project every time I open the Project. I tried adding it to the project as is suggested, above, and I tried adding it using the "Add File to Project" button. The outcome is the same either way. I did a Project Save after both methods.

I'm still a relative newbie, so it's probably a "cockpit problem". Ideas?

Regards, EdC

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Help

#4 Post by slavisa.zlatanovic » 22 Jun 2011 12:04

Hi!

I tried to reproduce the issue you're talking about but I couldn't. Everything worked OK both in mikroC PRO for PIC v4.60 and v4.80 BETA.
Please, send me your project, I'll inspect it and suggest further steps.
slavisa.zlatanovic@mikroe.com
Best regards
Slavisa

cernek
Posts: 3
Joined: 21 Aug 2010 15:29

Re: Help

#5 Post by cernek » 24 Jun 2011 02:14

Hi Slavisa. Thanks.
I am using WinXP (running under VMWare Fusion 3.1.3, on a MacBook Pro running 10.6.7).
Now, a walk-through...
1 - I start mikroC Pro for PIC: it says it is version v.4.60.0.0 at the top, left, corner of the window.
2 - I click Projects>Recent Projects>...\ADC_SIO.mcppi. My Project comes up, including my C source code, ADC_SIO.c, in the editor.
3 - I mouse over to the Project Manager tab, on the right. It opens and says that my project only has two files associated with it: ADC_SIO.hex and ADC_SIO.asm.
4 - I click on Built Current Project, at the top, and the compiler complains that the main function is not defined.
5 - Again, I mouse over to the Project Manager tab, on the right. When It opens, I right-click on Sources and add file ADC_SIO.c.
6 - Again, I click on Built Current Project, at the top, and the compiler is now happy.
7 - I notice that the Save Project button at the top-left is highlighted and I save the project. The Save Project button is now grayed-out.
8 - Now I close out the IDE, restart it, and repeat the process. When I get to step 3, the C source is still not there, and when I get to step 4, the compiler still complains.

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Help

#6 Post by slavisa.zlatanovic » 24 Jun 2011 12:32

Hi!
I am using WinXP (running under VMWare Fusion 3.1.3, on a MacBook Pro running 10.6.7).
Unfortunately, I can not recreate the same testing conditions so I can try to reproduce your problem.
If you have the same problems when working on the PC with XP OS, please, contact me again.
Best regards
Slavisa

Muphy
Posts: 318
Joined: 24 Feb 2008 14:05
Location: Stonehaven Scotland

Re: Help

#7 Post by Muphy » 24 Jun 2011 12:43

I have an almost identical setup on my MacBook so I may be able to test it for you. Is it worth you sending me your project? PM me and I'll give you an e-mail address to send it to.


M

Post Reply

Return to “mikroC PRO for PIC General”