vs2017缺少类型说明符-假定为int。注意:C++不支持默认int

发布时间:2019-08-07 06:25:12

vs2017 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int

推荐回答

还没有选出推荐答案,请稍候访问或查看其他回答!

其他回答

VS2013比VS2010更严格了,原先scanf只是警告,现在是错误

所以用VS2013编写纯C代码比较麻烦,当然也可以设置。

右击工程 - 属性 - 配置属性 - C/C++  - 命令行 

命令行增加 /D _CRT_SECURE_NO_WARNINGS

这样就不用改代码了

Test1.h

[cpp] view plain copy#ifndef Test1_H  #define Test1_H  //#include "Test2.h" //用下面的方式替代  class Test2;//注意:只是告诉编译器,需要这个类,其他功能结构等都没    class Test1  {  public:      Test2* test2;      void Test1::className(Test2* test2);      void refMe();  };  #endif;  

Test1.cpp

[cpp] view plain copy#include "StdAfx.h"  #include "Test1.h"  #include <iostream>    #include "Test2.h" //注意:这里才是真正的包含    void Test1::className(Test2* test2)  {      this->test2=test2;      std::cout<<"Test1  ";  }    void Test1::refMe()  {      std::cout<<"refMe Test1"<<std::endl;  }  

以上问题属网友观点,不代表本站立场,仅供参考!