Coding help

Hey, so I went to open up my competition code and for some reason the compiler said that:
File “.\Includes\Vex_Competition_Includes.c” compiled on Nov 10 2016 16:03:39
Error:No body defined for procedure prototype ‘usercontrol’
Warning:Unreferenced function ‘pre_auton’
Warning:Unreferenced function ‘UserControlCodePlaceholderForTesting’
Warning:Unreferenced function ‘AutonomousCodePlaceholderForTesting’
and I don’t know how to fix it. Can someone please help me?


void allMotorsOff();
void allTasksStop();
void pre_auton(); //error here
task autonomous();
task usercontrol(); //error here
static void AutonomousCodePlaceholderForTesting();
static void UserControlCodePlaceholderForTesting();

int nTimeXX = 0;
bool bStopTasksBetweenModes = true;

static void displayStatusAndTime();



task main()
{
	// Master CPU will not let competition start until powered on for at least 2-seconds
	clearLCDLine(0);
	clearLCDLine(1);
	displayLCDPos(0, 0);
	displayNextLCDString("Startup");
	wait1Msec(2000);
}

void pre_auton()
{
	bStopTasksBetweenModes = true;
}


task autonomous()
{

	while (true)
	{

		clearLCDLine(0);
		clearLCDLine(1);
		displayLCDPos(0, 0);

		while (bIfiRobotDisabled)
		{
			displayLCDPos(0, 0);
			displayNextLCDString("Disabled");
			nTimeXX = 0;
			while (true)
			{
				displayStatusAndTime();
				if (!bIfiRobotDisabled)
					break;
				wait1Msec(25);

				displayStatusAndTime();
				if (!bIfiRobotDisabled)
					break;
				wait1Msec(25);

				displayStatusAndTime();
				if (!bIfiRobotDisabled)
					break;
				wait1Msec(25);

				displayStatusAndTime();
				if (!bIfiRobotDisabled)
					break;
				wait1Msec(25);
				++nTimeXX;
			}
		}

		nTimeXX = 0;
		clearLCDLine(0);
		clearLCDLine(1);
		displayLCDPos(0, 0);
		if (bIfiAutonomousMode)
		{
			displayNextLCDString("Autonomous");
			startTask(autonomous);

			// Waiting for autonomous phase to end
			while (bIfiAutonomousMode && !bIfiRobotDisabled)
			{
				if (!bVEXNETActive)
				{
					if (nVexRCReceiveState == vrNoXmiters) // the transmitters are powered off!!
						allMotorsOff();
				}
				wait1Msec(25);               // Waiting for autonomous phase to end
			}
			allMotorsOff();
			if(bStopTasksBetweenModes)
			{
				allTasksStop();
			}
		}

		else
		{
			displayNextLCDString("User Control");
			startTask(usercontrol);

			// Here we repeat loop waiting for user control to end and (optionally) start
			// of a new competition run
			while (!bIfiAutonomousMode && !bIfiRobotDisabled)
			{
				if (nVexRCReceiveState == vrNoXmiters) // the transmitters are powered off!!
					allMotorsOff();
				wait1Msec(25);
			}
			allMotorsOff();
			if(bStopTasksBetweenModes)
			{
				allTasksStop();
			}
		}
	}
}

void allMotorsOff()
{
	motor[port1] = 0;
	motor[port2] = 0;
	motor[port3] = 0;
	motor[port4] = 0;
	motor[port5] = 0;
	motor[port6] = 0;
	motor[port7] = 0;
	motor[port8] = 0;
#if defined(VEX2)
	motor[port9] = 0;
	motor[port10] = 0;
#endif
}

void allTasksStop()
{
	stopTask(1);
	stopTask(2);
	stopTask(3);
	stopTask(4);
#if defined(VEX2)
	stopTask(5);
	stopTask(6);
	stopTask(7);
	stopTask(8);
	stopTask(9);
	stopTask(10);
	stopTask(11);
	stopTask(12);
	stopTask(13);
	stopTask(14);
	stopTask(15);
	stopTask(16);
	stopTask(17);
	stopTask(18);
	stopTask(19);
#endif
}

static void displayStatusAndTime()
{
	displayLCDPos(1, 0);
	if (bIfiRobotDisabled)
		displayNextLCDString("Disable ");
	else
	{
		if (bIfiAutonomousMode)
			displayNextLCDString("Auton  ");
		else
			displayNextLCDString("Driver ");
	}
	displayNextLCDNumber(nTimeXX / 600, 2);
	displayNextLCDChar(':');
	displayNextLCDNumber((nTimeXX / 10) % 60, -2);
	displayNextLCDChar('.');
	displayNextLCDNumber(nTimeXX % 10, 1);
}

void UserControlCodePlaceholderForTesting() //error here
{
	while (true)
	{
	// Following code is simply for initial debuggging.
	//
	// It can be safely removed in a real program	and removing it will slightly improve the
	// real-time performance of your robot.
	//
	displayStatusAndTime();
	wait1Msec(100);
	++nTimeXX;
	}
}

void AutonomousCodePlaceholderForTesting() //and final error here          
{
	// This is where you insert your autonomous code. Because we don't have any, we'll
	// simply display a running count of the time on the VEX LCD.

	while (true)
	{
		displayStatusAndTime();
		wait1Msec(100);
		++nTimeXX;
	}
}

Liam

That code above is a mixture of the Vex_Competition_Includes.c file (which is a system file and you should not edit) and a competition template. The competition template is opened from the file->new menu and looks like this.

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VEX EDR                      */
/*                                                                           */
/*---------------------------------------------------------------------------*/

// This code is for the VEX cortex platform
#pragma platform(VEX2)

// Select Download method as "competition"
#pragma competitionControl(Competition)

//Main competition background code...do not modify!
#include "Vex_Competition_Includes.c"

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks
  // running between Autonomous and Driver controlled modes. You will need to
  // manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;

	// Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
	// used by the competition include file, for example, you might want
	// to display your team name on the LCD in this function.
	// bDisplayCompetitionStatusOnLcd = false;

  // All activities that occur before the competition starts
  // Example: clearing encoders, setting servo positions, ...
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              Autonomous Task                              */
/*                                                                           */
/*  This task is used to control your robot during the autonomous phase of   */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

task autonomous()
{
  // ..........................................................................
  // Insert user code here.
  // ..........................................................................

  // Remove this function call once you have "real" code.
  AutonomousCodePlaceholderForTesting();
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              User Control Task                            */
/*                                                                           */
/*  This task is used to control your robot during the user control phase of */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

task usercontrol()
{
  // User control code here, inside the loop

  while (true)
  {
    // This is the main execution loop for the user control program.
    // Each time through the loop your program should update motor + servo
    // values based on feedback from the joysticks.

    // ........................................................................
    // Insert user code here. This is where you use the joystick values to
    // update your motors, etc.
    // ........................................................................

    // Remove this function call once you have "real" code.
    UserControlCodePlaceholderForTesting();
  }
}

See if you can open the template and compile it.

If the robotc Vex_Competition_Includes.c file has been edited for some reason you will need to replace it with the original file that we provide as part of the installation, the easiest way would probably be to uninstall and then reinstall robotc.