I managed to find the problem, but not the solution. So there is a setting under project properties > general > project defaults > configuration type that is set to dynamic link library. If I change it to static, it will compile, but it won't load in maya. If I leave it at dynamic link library and I comment out the part where I use my lib, it will compile and load in maya.
The error I get in maya when I compile it with configuration type static is:
1 2 3
// Error: file: C:/Program Files/Autodesk/Maya2018/scripts/others/pluginWin.mel line 290: Unable to dynamically load : C:/Users/daniele/Documents/maya/plug-ins/ddRbf.mll
//
// Error: file: C:/Program Files/Autodesk/Maya2018/scripts/others/pluginWin.mel line 290: (ddRbf) //
I guess I won't be able to use a static lib then... Should I compile the math lib as a dynamic library?