The traps in C + + were so many that they made a mistake a long time ago. I defined the _utility_ in a header file, followed by the vector header file, and the result was an error in the following vector declaration (the display does not allow the use of incomplete types ). This makes me very depressed: I clearly contain the vector header file, but also use using the instructions. After a few simple analyses and attempts, the problem is easily solved. This is a naming conflict issue where we previously defined the _utility_ and vector header files in conflict. A simple question code is attached below:
Utility.h
1 #ifndef _utility_ 2 #define _utility_34#endif
Utility.cpp
1#include"Utility.h"2#include <iostream>3#include <vector>4 5 usingstd::vector;6 usingstd::cout;7 usingStd::endl;8 9 intMain ()Ten { One Avector<int> Ivec = {1,2,3 }; - //This will prompt you not to allow the use of incomplete types - for(auto I:ivec) thecout << i <<Endl; - - -System"Pause"); + return 1; - +}
Naming is a problem, I feel I now the naming specification is Win32 way + other way, such as: Class name First Capital, function, method list Word capitalization, class members before underlined, there are some common. Microsoft's Hungarian nomenclature some places now seem a bit cumbersome, inum people will be directly named Num. This is the same readability, and the compiler will prompt the type int. Then use pinyin to name the feeling is too unprofessional, so still more recite the word!
C + + naming chat