sourcey / libsourcey

C++14 evented IO libraries for high performance networking and media based applications
https://sourcey.com/libsourcey
GNU Lesser General Public License v2.1
1.31k stars 347 forks source link

Compilation error on Windows #250

Open ianshade opened 6 years ago

ianshade commented 6 years ago

I'm getting the following error when I'm trying to compile the latest version with Visual Studio 2017:

13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(194): error C2131: expression did not evaluate to a constant 13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(194): note: failure was caused by a read of a variable outside its lifetime 13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(194): note: see usage of 'npending' 13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(206): error C2131: expression did not evaluate to a constant 13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(206): note: failure was caused by a read of a variable outside its lifetime 13>d:\source\repos\libsourcey\src\net\src\ssladapter.cpp(206): note: see usage of 'npending'

Does it have something to do with lack of support for variable length arrays in MSVC?

0xdeadbeef-7a1e commented 5 years ago

I'm struggling with this. is there any news regarding this issue?

ianshade commented 5 years ago

I unfortunately haven't found any solutions. I gave up trying to use this library.

0xdeadbeef-7a1e commented 5 years ago

Well, i did find a solution for that specific error: char buffer[npending]; -> char* buffer = new char[npending];

VS compiler does not support variables as an index.

raz-ai commented 5 years ago

@gerarq I ended up doing the same thing with the arrays in msvc. I opened up an issue on the same thing just recently, along with some deprecated #defines.

https://github.com/sourcey/libsourcey/issues/256

Did it work well for you after that? I haven't yet tested out the code that fix touches.