So, I'm working on a project where I'm intended to implement my own versions of the trigonometric functions, square root, rounding & exponents without assistance from the math.h or cmath libraries that must be done using Visual Studio 2015 or 2017. I'm accustomed to working with GCC, where when not explicitly including math.h or cmath their respective functions are not linked. In my empty, freshly installed Visual Studio projects upon including only iostream, I seem to acquire the ability to use the sin, cos and tangent functions, as well as an error for repeat declarations of functions. I have since created a dummy project freshly on both computers (One is a work computer running a fresh installation of VS2017, the other is a personal computer running VS2015) and stripped out all linked libraries, and am still unable to find a way to remove the mathematics libraries from being included when I only have
#include <iostream>
int main()
{
float n = sin(3.1415f);
return 0;
};
in my entire project. I'm unsure how, without being linked to external files, with rebuilding the project, and without any other includes, I'm able to access the sin() function. Further if I change my file to
#include <iostream>
float sin(float n)
{
return 1.0f;
};
int main()
{
float n = sin(3.1415f);
return 0;
};
It presents me with C2382. This occurs whether or not my external dependencies has other files in it or not. How would I go about removing the inclusion to math.h while maintaining access to basic functionality such as printf(), std::cout, and system("PAUSE"); for the purpose of this project like I would in a GCC environment?
- Sadly, although I've been developing within a namespace to check my implementations against the standard library, I'm not intended to have the standard mathematics functions even linked to the end-result. This is easy to accomplish in GCC, but as I mentioned, this project has to be in VS.