So, I started to try to make my own library the other day with Visual Studio 2017, and I have been struggling.. I got it working, sorta, but one of my functions would return "-nand(ind)" instead of the fixed return value of "5.0" I put inside of the function.. that issue resolved itself, somehow, but more appeared after.. when I tried to add a second function to debug, with the same return value, it was just an overloaded function, it seemed to work properly.. except for the other one. instead of returning "5" like I specified for it to, it returns "1". Also, when you try to run both of the functions within the same program, it fails to compile.
Related code snippets:
mUtils.h (header file for my functions)
#pragma once
namespace mDay {
class mUtils {
public:
static float map(float val, float minRA, float maxRA, float minRB, float maxRB);
static float map(float val, float minR, float maxR);
};
}
mUtils.cpp (source file for my functions)
#include "mUtils.h"
namespace mDay {
float mUtils::map(float val, float minRA, float maxRA, float minRB, float maxRB) {
return 5.0; // minRB + (maxRB - minRB) / (maxRA - minRA) * (val / minRA)
}
float mUtils::map(float val, float minR, float maxR) {
return 5.0;
}
}
mDay.h (header file to compile all of the classes in my library)
#pragma once
#include "mUtils.h"
#include "mDebug.h"
mainApp.cpp (the program I'm using to debug)
#include <iostream>
#include "mDay.h"
#define deb mDay::mDebug::
#define uti mDay::mUtils::
using namespace std;
int main()
{
float dA = uti map(0, 1, 1);
float dB = uti map(0, 1, 0, 1, 0);
cout << dA << endl;
cout << dB << endl;
return 0;
}