Error - Main function is not defined
Error - Main function is not defined
I am trying a very simple program just to test proraming a 16F628A
Here is the program as typed in the compiler editor:
program gencontrol
main:
' Main program
TRISB = 0
eloop:
PORTB = $FF
Delay_ms(1000)
PORTB = 0
Delay_ms(1000)
goto eloop
end.
I click on Project>Build
It returns with following error messages:
357 main function is not defined
452 Unsucessful linking 'GENCONTROL.mbppi'
102 Finished (with errors)
Project manager has the following files listed:
Sources>
gencontrol.mbas
Output Files>
gencontrol.asm
no hex file nothing else.
I have tried searchig if someone had a similar problem but no luck.
PLEASE HELP
Here is the program as typed in the compiler editor:
program gencontrol
main:
' Main program
TRISB = 0
eloop:
PORTB = $FF
Delay_ms(1000)
PORTB = 0
Delay_ms(1000)
goto eloop
end.
I click on Project>Build
It returns with following error messages:
357 main function is not defined
452 Unsucessful linking 'GENCONTROL.mbppi'
102 Finished (with errors)
Project manager has the following files listed:
Sources>
gencontrol.mbas
Output Files>
gencontrol.asm
no hex file nothing else.
I have tried searchig if someone had a similar problem but no luck.
PLEASE HELP
- mileta.miletic
- mikroElektronika team
- Posts: 493
- Joined: 05 Jun 2009 14:46
- Location: Belgrade, Serbia
- Contact:
Re: Error - Main function is not defined
Hi,
please send your project (project folder with all files in it) to support desk http://www.mikroe.com/en/support/
please send your project (project folder with all files in it) to support desk http://www.mikroe.com/en/support/
Regards,
Mileta
Mileta
452 Unsucessful linking 'boot_test.mbppi'
I have exactly the same problem with the code comming from mikroElektronika:
C:\Logiciels\MikroBasic\Examples\Other\Bootloader\P18\32K\boot_test.mbppi
It returns with following error messages:
452 Unsucessful linking 'GENCONTROL.mbppi'
102 Finished (with errors)
I tried to copy the code in a new project as explain here:
http://www.mikroe.com/forum/viewtopic.p ... ul+linking
but the problem is still here.
Does it exist a solution?
Thanks for your help.
C:\Logiciels\MikroBasic\Examples\Other\Bootloader\P18\32K\boot_test.mbppi
It returns with following error messages:
452 Unsucessful linking 'GENCONTROL.mbppi'
102 Finished (with errors)
I tried to copy the code in a new project as explain here:
http://www.mikroe.com/forum/viewtopic.p ... ul+linking
but the problem is still here.
Does it exist a solution?
Thanks for your help.
Did you check your project search paths?
Go to Project> Edit Search paths and make sure they point to the correct folder.
I compiled the example mentioned and it works fine.
Go to Project> Edit Search paths and make sure they point to the correct folder.
I compiled the example mentioned and it works fine.
--------------------------------
Kind Regards,
Waleed El-Badry
Teaching Assistant
Mechatronics Engineering Department
Misr University for Science & Technology
Kind Regards,
Waleed El-Badry
Teaching Assistant
Mechatronics Engineering Department
Misr University for Science & Technology
My MikroBasic Pro is installed here : C:\Logiciels\MikroBasic\
In the Project> Edit Search, I have :
C:\Logiciels\MikroBasic\Defs\
C:\Logiciels\MikroBasic\Uses\P18\
C:\Logiciels\MikroBasic\Examples\Other\Bootloader\P18\32K\
I tried to build project with a Pic 18F4550, anf I have put these files in the project:
boot_test.mbas
boot18_32K.mbas
and P18F4550.mbas from C:\Logiciels\MikroBasic\Defs\ but the result is the same with or without this file.
Thanks for your help
In the Project> Edit Search, I have :
C:\Logiciels\MikroBasic\Defs\
C:\Logiciels\MikroBasic\Uses\P18\
C:\Logiciels\MikroBasic\Examples\Other\Bootloader\P18\32K\
I tried to build project with a Pic 18F4550, anf I have put these files in the project:
boot_test.mbas
boot18_32K.mbas
and P18F4550.mbas from C:\Logiciels\MikroBasic\Defs\ but the result is the same with or without this file.
Thanks for your help
You might have unchecked few necessary files in the Library managers. When you reinstalled the compiler, you got back the original setting.
It is only a speculation
Glad your problem is solved.
It is only a speculation
Glad your problem is solved.
--------------------------------
Kind Regards,
Waleed El-Badry
Teaching Assistant
Mechatronics Engineering Department
Misr University for Science & Technology
Kind Regards,
Waleed El-Badry
Teaching Assistant
Mechatronics Engineering Department
Misr University for Science & Technology
I've had the same problem; here's how to fix it:
Click on Project Manager on the right side of your screen.
Click on the plus sign (+) to the left of your program name. There should be a plus sign (+) to the left of the Sources folder.
Click on the plus sign (+) to the left of the Sources folder. This should be the name of your program.
If there is no plus sign (+) to the left of the Sources folder, you will get the error you have described. To fix this, RIGHT click on the Sources folder, then click on Add File to Project... Locate your program file, click on it, then click the Open button. This will fix the problem. :wink:
Click on Project Manager on the right side of your screen.
Click on the plus sign (+) to the left of your program name. There should be a plus sign (+) to the left of the Sources folder.
Click on the plus sign (+) to the left of the Sources folder. This should be the name of your program.
If there is no plus sign (+) to the left of the Sources folder, you will get the error you have described. To fix this, RIGHT click on the Sources folder, then click on Add File to Project... Locate your program file, click on it, then click the Open button. This will fix the problem. :wink:
Re:
Had the same problem,roys29 wrote:I've had the same problem; here's how to fix it:
Click on Project Manager on the right side of your screen.
Click on the plus sign (+) to the left of your program name. There should be a plus sign (+) to the left of the Sources folder.
Click on the plus sign (+) to the left of the Sources folder. This should be the name of your program.
If there is no plus sign (+) to the left of the Sources folder, you will get the error you have described. To fix this, RIGHT click on the Sources folder, then click on Add File to Project... Locate your program file, click on it, then click the Open button. This will fix the problem.
SOLVED by your answer!
THANK YOU!
My simulation cockpit and other projects: www.numca.gr
Re: Error - Main function is not defined
I sometimes have the same issue, it is caused when the project file loses the entry for the main module. You can also edit the project file as follows:
Code: Select all
[FILES]
Count=1
File0=mainmodule.mbas
-
- Posts: 12
- Joined: 28 Aug 2017 23:20
Re: Error - Main function is not defined
I've had the same problem; here's how to fix it:
Click on Project Manager on the right side of your screen.
Click on the plus sign (+) to the left of your program name. There should be a plus sign (+) to the left of the Sources folder.
Click on the plus sign (+) to the left of the Sources folder. This should be the name of your program.
If there is no plus sign (+) to the left of the Sources folder, you will get the error you have described. To fix this, RIGHT click on the Sources folder, then click on Add File to Project... Locate your program file, click on it, then click the Open button. This will fix the problem.
/*Excellent observation and help in error correction. The strange thing is that I had compiled without any problem the program a day ago and the next day came this error. But you can fix it by reinserting the .c file*/
Thank you my friend.
Click on Project Manager on the right side of your screen.
Click on the plus sign (+) to the left of your program name. There should be a plus sign (+) to the left of the Sources folder.
Click on the plus sign (+) to the left of the Sources folder. This should be the name of your program.
If there is no plus sign (+) to the left of the Sources folder, you will get the error you have described. To fix this, RIGHT click on the Sources folder, then click on Add File to Project... Locate your program file, click on it, then click the Open button. This will fix the problem.
/*Excellent observation and help in error correction. The strange thing is that I had compiled without any problem the program a day ago and the next day came this error. But you can fix it by reinserting the .c file*/
Thank you my friend.
-
- Posts: 1
- Joined: 10 Dec 2023 09:22
Re: Error - Main function is not defined
You can see your project Manager window at right side. when you see under Source, maybe there no any source files are linked to your current project. so first thing you have to do is Right click on Source and add new or add exiting source files.