c++ - Visual C++ 可以检查不匹配的原型(prototype)和实现吗?

标签 c++ visual-c++ visual-c++-2013

如果找不到原型(prototype)的实现,VC 编译器会发出警告吗?

示例(注意不匹配的参数):

// calcSomething.h
int calcSomething(
    int    year,
    int    month,
    int    day,
    int    hour,
    int    minute,
    int    second
);

// calcSomething.cpp
int calcSomething(
    int    year,
    int    month,
    int    day
) 
{
  // ... implementation
}

更新:显然 G++ 有一个名为 -Wmissing-declarations 的开关,我认为它可能符合我的需要,但对于 VC++ 来说显然是这样。

最佳答案

看来答案是否定的。 MSVC 编译器没有等同于 G++ 的 -Wmissing-declarations 的选项。

Command line options by category .

关于c++ - Visual C++ 可以检查不匹配的原型(prototype)和实现吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21236710/

相关文章:

java - 从 C++ 调用 Java

c++ - 正在运行的线程中的 cstatic 控件的 Redrawwindow

C++声明许多相似的类而不重复自己

c++ - 可变函数和折叠表达式 : Fatal Error while trying to compile in Visual Studio 2017

c++ - 如何在 C++ 的主函数之外使用 int argc,char *argv[]?

c++ - 在模板函数内的括号内使用 lambda 时,左括号不正确匹配

c++ - IUnknown 指针引用

visual-studio - 如何选择当前项目进行查找和替换

C++、WIN32、WndProc 到成员函数崩溃(0x88 处的访问冲突)

c++ - wstring 到 LPCWSTR 不使用 c_str()