C++ + Visual Studio 2012 (VS2012) + Win8 , converting projects up some conflicts I found

12 May 2013 . category: . Comments

Having loved the ability to compile VS2010 projects inside the VS2012 shell as a way of delaying the update, I thought it was time to stop delaying ( 1 Year late ).

std::cout << "Minimum value for int: " << std::numeric_limits<int>::min() << std::endl;
std::cout << "Maximum value for int: " << std::numeric_limits<int>::max() << std::endl;

Generates error:

error C2059: syntax error : '::' [path]\source.cpp

There is a good chance if you have these lines and are including the windows header you will hit an error. The Windows team put in a solution to the #define min conflict in <minwindef.h>.

So instead of

#include <windows.h>

You use a #define to avoid this

#define NOMINMAX
#include <windows.h>

Another issue I found was with an annoying char define, again from the Windows team in <rpcndr.h>.

#define small char

This one doesn’t have the ability to comment out for so if you have a small function with something like:

AnObj small = large.resize(val);

Generates error:

error C2628:'AnObj' followed by 'char' is illegal (did you forget a ';'?) [path]\source.cpp

You will have to suffer and change the name, in some ways it teaches you (me) for not being very specific, still annoying though. Hopefully this is all the conversion errors I’ll hit.


Stuart James  


Stuart James

Assistant Professor in Visual Computing at Durham University. Stuart's research focus is on Visual Reasoning to understand the layout of visual content from Iconography (e.g. Sketches) to 3D Scene understanding and their implications on methods of interaction. He is currently a co-I on the RePAIR EU FET, DCitizens EU Twinning, and BoSS EU Lighthouse. He was a co-I on the MEMEX RIA EU H2020 project coordinated at IIT for increasing social inclusion with Cultural Heritage. Stuart has previously held a Researcher & PostDoc positions at IIT as well as PostDocs at University College London (UCL), and the University of Surrey. Also, at the University of Surrey, Stuart was awarded his PhD on visual information retrieval for sketches. Stuart holds an External Scientist at IIT, Honorary roles UCL and UCL Digital Humanities, and an international collaborator of ITI/LARSyS. He also regularly organises Vision for Art (VISART) workshop and Humanities-orientated tutorials and was Program Chair at British Machine Conference (BMVC) 2021.