I spent the day looking at similar errors online, but I'm still having trouble understanding how it applies to my project.
I'll post a full-class simplified version of the program.
I have a header file with some static methods in it:
#pragma once
class A {
public:
static void function_a1(float &var_1);
static void function_a2(float &var_1);
}
I also have a .cpp file which defines the methods:
#include "A.h"
void A::function_a1(float &var_1) {
...
}
void A::function_a2(float &var_1) {
...
}
The functions are meant to modify the variables I send through. I'm trying to call them within my main.cpp file:
#include "A.h"
using namespace std;
void main() {
float x = 1.0f;
float y = 2.4f;
A::function_a1(x);
A::function_a2(y);
}
But this doesn't build, instead telling me that A::function_a1(&float)
and A::function_a2(&float)
are unresolved external symbols. I'm not used to C++, so am I using statics wrong? How would I go about fixing this?
I'm definitely sending through the correct variables - the functions within A.h used to be within my main.cpp and I'm trying to move them over to a separate file.
I saw the post that this is a "duplicate" of, but I can't figure out how to apply any of those answers to my question.