0

I use the armadillo library in visual C++ to take care of some matrix and vector operations. Here's what one of my cpp files looks like:

#include "stdafx.h"
#include <cmath>
#include <armadillo>
#include "buildRotMatrix.h"

using namespace std;
using namespace arma;

//code

When I compile I get the following warning:

1>CL : warning : detected 'min' and/or 'max' macros and undefined them;
1>CL : warning : you may wish to define NOMINMAX before including any windows header

I don't actually use min and max functions in the code but i'd like to get rid of the warnings. adding #define NOMINMAX hasn't worked and I haven't found other solutions. It's not clear to me where the conflict comes from since my understanding from google searches is people get it from including windows.h.

Alex
  • 43
  • 1
  • 5
  • You must add `#define NOMINMAX` before including and Windows hear, like Windows.h. If you include those in multiple places you need to either define it in all of those places or add it as a global define to your project. – Retired Ninja Aug 15 '18 at 15:52
  • You should also added the lean_and_mean see https://stackoverflow.com/questions/1394910/how-to-tame-the-windows-headers-useful-defines – Martin Beckett Aug 15 '18 at 15:53
  • @RetiredNinja : just to clarify 1) which of the headers in the example code is a windows header? 2) as I explained I have tried adding #define NOMINMAX both in .h files and in .cpp files, but it has not helped. i'll double check that i did it everywhere, as I may have missed a file. but if i missed a single file, would i still be getting the warning for every file that uses the armadillo library? Thanks again for your help. – Alex Aug 15 '18 at 16:56
  • @RetiredNinja turns out I had missed a couple files where I hadn't added #define NOMINMAX, and that caused warnings in ALL the files, meaning that I couldn't pinpoint which files were the issue. Thanks for your help, I wouldn't have looked through all the files again if you hadn't commented. – Alex Aug 15 '18 at 21:07

0 Answers0