Linker Tools Warning LNK4249

directive 'threading_attribute' conflicts with command line; ignored

The threading attribute specified in source code was overridden by the threading model specified with /CLRTHREADATTRIBUTE.

For more information, see /CLRTHREADATTRIBUTE (Set CLR Thread Attribute).

To correct this error

  • Remove the threading attribute from your source code or link without /CLRTHREADATTRIBUTE.

Example

The following sample generates LNK4249.

// LNK4249.cpp
// compile with: /clr /W1 /link /CLRTHREADATTRIBUTE:STA
// LNK4249 expected
ref class MyClass {
public:
   int i;
};
[System::MTAThreadAttribute]
int main() {
   System::Console::WriteLine("test");
}