Elad Weiss
Elad Weiss

Reputation: 4002

How to work around VS "can be made static" warning

I am writing a Cpp library in VS2022 community, and for some reason VS gives me a "VCR003 Function can be made static" warning for the exported functions. I am not an export, but it makes absolutely no sense that exported functions will be made with static linkage. What is the right approach here, should I simply suppress these warnings?

Example:

extern "C" {

__declspec(dllexport)
void foo()
{
    // Foo code
}

}

enter image description here


Edit: It turns out this is a bug in VS. For those who encounter the same issue, I am using:

enter image description here

Upvotes: 1

Views: 561

Answers (1)

Minxin Yu - MSFT
Minxin Yu - MSFT

Reputation: 4259

As the link provided by user17732522:

https://developercommunity.visualstudio.com/t/Information-message-VCR003-given-for-ext/10729403

A fix for this issue has been internally implemented and is being prepared for release.


For me: the message occurs when put the code in cpp file:

enter image description here

Upvotes: 0

Related Questions