AnsweredAssumed Answered

main not defined (?)

Question asked by Allen Babb on Jul 12, 2011
Latest reply on Jul 12, 2011 by Allen Babb

Hi again,

 

well, after I managed to get past the problem with the vector tables, I somehow borked the files somewhere so that now the compiler doesn't recognize main.c as being, well, main.c. It instead thinks its some sort of header file. (!?)

 

Reason I believe this to be so, is that when I try to compile the project, it gives me the error "; not found" and then immediately after a hole bunch of errors that don't make any right sense.

 

here is a snippet of the main function:

 

I apologize in advance for not being 100% ISO complient... I've never had a class over C nor had a need to make a C program. I did have two C++ classes which really where not that in depth at all.

 

#include <hidef.h>      // common defines and macros#include "derivative.h" // derivative-specific definitions#include "MCUinit.h"    // device initialization and ISRs#include <math.h>       // ANSI and IEEE math library//#include "main_asm.h" // interface to the assembly module#include "AD_ATD.h"     // ATD conversion & cleaning functions#include "AD_Math.h"#include "AD_Pilot.h"#include "AD_PWM.h"#include "AD_TIM.h"#include "RazorIMU.h"/* Global Variables */unsigned char OSflags;const unsigned short DTYOFF  =   900;    //This is used to make the motor spin at or above 1.0ms.const unsigned short DTYIDLE =  1000;    //0% throttle = 1.000ms const unsigned short DTYFULL =  2000;    //100% throttle = 2.000ms (hopefully)const unsigned short PER     = 20000;    //Frame rate = 50Hz, 20ms period /* Global Functions */void MCU_init(void);    // Device initialization function declaration/* System Program and Flight Path administration */void main(void){  MCU_init();           // call Device Initialization//Wait a bit to allow the ADC to stabilize  OpenPilot();     //Wake up the AutoPilot    TakeOff();       //Takeoff from current position  ThrottleToPWM(HeightToThrottle(136));     //Set throttle to achieve 136cm (hopefully)    WaitSec(30);     //Wait for 30 seconds    Land();     //Shutdown motors//asm_main(); /* call the assembly function */  for(;;) {    // _FEED_COP();     // by default, COP is disabled with device init. When enabling, be sure to also reset the watchdog.  } // loop forever   // please make sure that you never leave main, otherwise you might run into unmapped areas of memory... or worse!  return 0; //Just to make the compiler happy}

 

Any suggestions of course would be helpful. 

Outcomes