xricht17 / twpp

TWAIN framework for C++11. Makes development of applications and data sources much easier.
MIT License
39 stars 17 forks source link

will not compile on vs2017 #13

Closed craigbroadbear closed 6 years ago

craigbroadbear commented 6 years ago

I get some baffling errors in strings.hpp 'unexpected tokens preceding ;'

c++ templates do confuse me, so I am not clear what the issue is.

xricht17 commented 6 years ago

Hi, could you provide the whole error message? There is not much I can do without it.

craigbroadbear commented 6 years ago

d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(109): error C2589: '(': illegal token on right side of '::' 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(251): note: see reference to class template instantiation 'Twpp::Detail::Str' being compiled 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(109): error C2062: type 'unknown-type' unexpected 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(109): error C2334: unexpected token(s) preceding ':'; skipping apparent function body 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(251): error C2143: syntax error: missing ')' before ';' 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(251): error C2059: syntax error: ')' 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(251): error C2238: unexpected token(s) preceding ';' 1>d:\tmp\wtlapp\wtlapp\twpp\strings.hpp(251): fatal error C1201: unable to continue after syntax error in class template definition 1>Done building project "wtlapp.vcxproj" -- FAILED.

craigbroadbear commented 6 years ago

Seems to be some sort of problem with std::numeric_limits::max(). I commented out that line and it compiled that file only to find similar errors in other files.

xricht17 commented 6 years ago

Do you, by any chance, include Windows.h or WinDefs.h before including twpp.hpp? I think it is the following issue: https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax

It should be enough to either define NOMINMAX, or not to include Windows.h and WinDefs.h, TWPP does that automatically.

craigbroadbear commented 6 years ago

Yep, I put a

define NOMINMAX

before any headers and that did the trick. Looks like a nice library you have developed. Thankyou!