1

I am trying to statically link a Qt library I am building to Botan using MSVC on Windows and am receiving the following error.

..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(129) : error C2589: '(' : illegal token on right side of '::'
        ..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(128) : while compiling class template member function 'void Botan::MemoryRegion<T>::copy(const T [],size_t)'
        with
        [
            T=Botan::byte
        ]
        ..\..\3rdparty\temp\botan-msvc\build\include\botan/buf_comp.h(41) : see reference to class template instantiation 'Botan::MemoryRegion<T>' being compiled
        with
        [
            T=Botan::byte
        ]
..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(129) : error C2059: syntax error : '::'

This does not occur with MinGW. It also occurs when I comment out all Botan-related code. What does this mean and how can I solve it - also why does it not occur with MinGW?

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
  • It's hard to tell from the error message, one would need to read the Botan headers to see what's wrong. Code written for gcc often requires fixes to build with MSVC, especially when templates are used. – Frank Osterfeld Dec 27 '10 at 14:26
  • 1
    Make sure the Windows header you are including doesn't define min and max macros - likely if you run your code through the preprocessor, you'll see std::min is being rewritten as something like `std::((x) < (y) ? (x) : (y))` which would match up with the error message you are seeing. – Jack Lloyd Dec 27 '10 at 15:47

1 Answers1

2

I was able to figure out the issue with help from Jack Lloyd's comment. Apparently something that's included through one path or another #defined "min". I just undefined it and my library compiles and links perfectly. Thanks Jack!

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225