1
Vote

VS2015 preprocessor error

description

I can compile and run the unit tests with no problem in VS2015, but if I #include CppLinq.h in my own VS2015 program, I get a series of preprocessor errors even if I don't actually use any cpplinq code:

...cpplinq.h(4115): warning C4003: not enough actual parameters for macro 'max'
...
...cpplinq.h(4150): warning C4003: not enough actual parameters for macro 'max'
...
...cpplinq.h(5465): warning C4003: not enough actual parameters for macro 'max'
...
...cpplinq.h(5463): error C2146: syntax error: missing ')' before identifier 'selector'
...
...cpplinq.h(5463): error C2433: 'TSelector': 'inline' not permitted on data declarations
...
...cpplinq.h(5463): error C2365: 'TSelector': redefinition; previous definition was 'template parameter'
...\cpplinq.h(5462): note: see declaration of 'TSelector'
...
...cpplinq.h(5463): error C2061: syntax error: identifier 'selector'
...
...cpplinq.h(5463): error C2059: syntax error: ')'
...
...cpplinq.h(5463): error C2988: unrecognizable template declaration/definition
...
...cpplinq.h(5470): warning C4003: not enough actual parameters for macro 'max'
...
...cpplinq.h(5470): error C2988: unrecognizable template declaration/definition
...
...cpplinq.h(5470): error C2059: syntax error: ')'
...
...cpplinq.h(5471): error C2143: syntax error: missing ';' before '{'
...
...cpplinq.h(5471): error C2447: '{': missing function header (old-style formal list?)
...
...cpplinq.h(5478): warning C4003: not enough actual parameters for macro 'min'
...
...cpplinq.h(5476): error C2146: syntax error: missing ')' before identifier 'selector'
...
...cpplinq.h(5476): error C2433: 'TSelector': 'inline' not permitted on data declarations
...
...cpplinq.h(5476): error C2365: 'TSelector': redefinition; previous definition was 'template parameter'
...\cpplinq.h(5475): note: see declaration of 'TSelector'
...
...cpplinq.h(5476): error C2061: syntax error: identifier 'selector'
...
...cpplinq.h(5476): error C2059: syntax error: ')'
...
...cpplinq.h(5476): error C2988: unrecognizable template declaration/definition
...
...cpplinq.h(5483): warning C4003: not enough actual parameters for macro 'min'
...
...cpplinq.h(5483): error C2988: unrecognizable template declaration/definition
...
...cpplinq.h(5483): error C2059: syntax error: ')'
...
...cpplinq.h(5484): error C2143: syntax error: missing ';' before '{'
...
...cpplinq.h(5484): error C2447: '{': missing function header (old-style formal list?)

Any suggestions, please?

comments

JeroenWalter wrote Jul 22, 2016 at 1:09 PM

add the following line in your stdafx.h before any #includes :

define NOMINMAX // so we wont have conflicts with std:: thing

JeroenWalter wrote Jul 22, 2016 at 1:11 PM

should be:

#define NOMINMAX // so we wont have conflicts with std:: thing