edanor/umesimd

Compiling fails with Visual Studio

Closed this issue · 0 comments

If you add #include "windows.h" before any other #include in Example1.h, this will happen:

c:\users\marehr\seqan\include\umesimd\plugins\avx2\mask/UMESimdMask4.h(55):
error C2064: term does not evaluate to a function taking 0 arguments [C:\Users\marehr\seqan\include\umesimd\examples\build\Example1.vcxproj]

c:\users\marehr\seqan\include\umesimd\plugins\avx2\mask/UMESimdMask4.h(55):
warning C4353: nonstandard extension used: constant 0 as function expression.  Use '__noop' function intrinsic instead [C:\Users\marehr\seqan\include\umesimd\examples\build\Example1.vcxproj]

The reason is that "windows.h" defines the macros TRUE and FALSE, which will rename the functions SIMDVecMask::TRUE() and SIMDVecMask::FALSE() as SIMDVecMask::1() and SIMDVecMask::0().

This is not allowed, thus the compiler error. I suggest to rename the TRUE and FALSE names, because it is not strange to include "windows.h" on windows.


I'm not sure how you compile on windows, but here is my method

# umesimd/examples/CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
project(Examples CXX)

# add the executable
add_executable(Example1 Example1.cpp)

target_compile_options(Example1 PRIVATE /arch:AVX2 /W2 /Oi -DWIN32 -D_WINDOWS -D_DEBUG -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX /bigobj)

How to compile:

# in umesimd/examples/
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build .