msvc12

Compiling gcc code in Visual Studio causes error C3646: '__attribute__': unknown override specifier

时光怂恿深爱的人放手 提交于 2019-12-02 02:04:36
I am getting the following error: error C3646: '__attribute__': unknown override specifier Code: LEMUR_PREALIGN char _stack[ sizeof(_Type) * _Count ] LEMUR_POSTALIGN; Complete error: 1>c:\program files\indri\indri 5.9\include\indri\greedy_vector(52): error C3646: '__attribute__': unknown override specifier Additional info: I am trying to use indri.lib in Visual Studio project. Jonathan Mee The __attribute__ command is a compiler specific command to gcc. And it is used on line 52 of this file with the ((align)) command , which: Specifies a minimum alignment (in bytes) for variables of the

std::thread cause deadlock in DLLMain

泄露秘密 提交于 2019-11-30 05:28:24
So, this is what I'm talking about: std is complex. In VS2013 this simple program will cause a deadlock. #include <thread> #include <windows.h> void foo() { } void initialize() { std::thread t(foo); } BOOL APIENTRY DllMain(HMODULE, DWORD reason, LPVOID) { switch (reason) { case DLL_PROCESS_ATTACH: initialize(); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; } Create a thread in DLLMain is totally wrong ? It's not true. From the document "Best Practices for Creating DLLs" of Microsoft: " Creating a thread can work if you do

Possible compiler bug in MSVC12 (VS2013) with designated initializer

自古美人都是妖i 提交于 2019-11-29 09:34:21
Using VS2013 Update 2, I've stumbled on some strange error message : // test.c int main(void) { struct foo { int i; float f; }; struct bar { unsigned u; struct foo foo; double d; }; struct foo some_foo = { .i = 1, .f = 2.0 }; struct bar some_bar = { .u = 3, // error C2440 : 'initializing' : cannot convert from 'foo' to 'int' .foo = some_foo, .d = 4.0 }; // Works fine some_bar.foo = some_foo; return 0; } Both GCC and Clang accept it. Am I missing something or does this piece of code exposes a compiler bug ? EDIT : Duplicate: Initializing struct within another struct using designated initializer

std::thread cause deadlock in DLLMain

别等时光非礼了梦想. 提交于 2019-11-29 04:07:21
问题 So, this is what I'm talking about: std is complex. In VS2013 this simple program will cause a deadlock. #include <thread> #include <windows.h> void foo() { } void initialize() { std::thread t(foo); } BOOL APIENTRY DllMain(HMODULE, DWORD reason, LPVOID) { switch (reason) { case DLL_PROCESS_ATTACH: initialize(); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; } Create a thread in DLLMain is totally wrong ? It's not true. From

unresolved external symbol __mm256_setr_epi64x

送分小仙女□ 提交于 2019-11-28 12:27:51
I have written and debugged some AVX code with g++ and now I'm trying to get it to work with MSVC, but I keep getting error LNK2019: unresolved external symbol __mm256_setr_epi64x referenced in function "private: union __m256i __thiscall avx_matrix::avx_bit_mask(unsigned int)const " (?avx_bit_mask@avx_matrix@@ABE?AT__m256i@@I@Z) The referenced piece of code is ... #include <immintrin.h> ... /* All zeros except for pos-th position (0..255) */ __m256i avx_matrix::avx_bit_mask(const std::size_t pos) const { int64_t a = (pos >= 0 && pos < 64) ? 1LL << (pos - 0) : 0; int64_t b = (pos >= 64 && pos <

unresolved external symbol __mm256_setr_epi64x

旧城冷巷雨未停 提交于 2019-11-27 07:00:48
问题 I have written and debugged some AVX code with g++ and now I'm trying to get it to work with MSVC, but I keep getting error LNK2019: unresolved external symbol __mm256_setr_epi64x referenced in function "private: union __m256i __thiscall avx_matrix::avx_bit_mask(unsigned int)const " (?avx_bit_mask@avx_matrix@@ABE?AT__m256i@@I@Z) The referenced piece of code is ... #include <immintrin.h> ... /* All zeros except for pos-th position (0..255) */ __m256i avx_matrix::avx_bit_mask(const std::size_t