The name with "::" behind VS2019 must be a class name or a namespace name. Solution summary

Preface

I just learned C++ some time ago 防重复声明, so I wrote it casually, and found that the implementation method kept reporting errors. After searching the Internet for a long time, the problem is not 防重复声明correct , but I found that it is in the middle. Here is a summary to facilitate the later resolution of the problem.

problem

Insert picture description here

solve

My header file declaration

#ifdef __PRE_JUDGE__
#define __PRE_JUDGE__

class preJudge
{
    
    
public:
	int addPreJudge();
	int cutPreJudge();
};

#endif // __PRE_JUDGE__

Will be ifndefwritten ifdef, as long as it is modified.
The reason is that work is not careful, the results look a long time, also need to understand ifndefis if not defwould not have made such a mistake.

It is also the case of preventing duplicate declarations from writing mistakes: sand sculpture demonstration of names other than classes or namespace

Note that the normative writing of anti-duplicate declaration is as follows:

#ifndef 标识符(保证唯一)
#define 标识符(保证唯一)

#endif

other

See other solutions on the Internet, link:

postscript

Of course, specific issues need specific analysis, but not every detail can be grasped in the process of growing up, so learn more, read more, remember.

Guess you like

Origin blog.csdn.net/XZ2585458279/article/details/113749905