PROS V5 Build Error - Undefined Reference to Class/Objects

Hello!

Our team is attempting to use PROS for our robot and we’ve run into an issue when trying to compile our project. From what I understand I believe the project is compiling, but the build fails during the linking process. Image linked below of the output.

Here is a link to our repository.

Does anyone know what I am doing wrong? I definitely gave definitions to the functions from Intake.h in the Intake.cpp file.
Also it is calling out the OKAPI drive object as a undefined reference too which is odd…

I am but a simple Java developer. C++ is weird…

@johnfogarty I noticed a few things in your code:


 using namespace pros;
 using namespace pros::literals;
 using namespace okapi;

the comments above the namespaces specifically state that only one namespace may be used at a time.

#ifndef CONSTANTS_H
#define CONSTANTS_H

int leftdrive_port = 19;
int rightdrive_port = 20;

Correct me if I am wrong about this one but I dont think you should not be assigning values to variables in header files.

change your functions from this :

void intake_fwd(){
    intake1.move_velocity(600);
  }

to this :

void Intake::intake_fwd(){
    intake1.move_velocity(600);
  }

Adding the


Intake::

(correct me if I am wrong) tells the compiler that the function is part of the class “Intake”

I would suggest reading some tutorials on C++ and classes in C++, I found this tutorial very helpful, as well as taking a look at the pros website.