平时用codeblocks,编译时出现这些问题,上网查结果很少,要么跳转要英文网站,请问这是因为这款软件默认GCC编译而提示这样的错误(gcc的特定语法?)还是英文导致搜索结果少(我用百度)
处理这些问题老是半天都找不到解决方法。如果前者,我应该改大众一些的IDE,如vc++;如果后者,我应该改为中文?
应该是前者吧,因为搜索结果老是看到gcc字眼,如果在cb里设置为vc++编程是否错误显示就是vc类型了呢?
附图_原错误代码
迷茫2017-04-18 10:53:30
There are three common declaration structures related to function templates: declaring function templates, declaring specializations, and declaring instances.
1 2 3 4 5 6 7 8 |
|
The same thing happens if you replace it with operator overloading
1 2 3 4 5 6 7 8 9 |
|
I think you are not specializing here, you just want to declare the template. Because you used template parameters in the function parameter list. Refer to the first way of writing.
If you don’t do too much template development, the overloading of stream’s << is actually this routine, just memorize it. Another common form is
1 2 3 |
|
I don’t think it’s necessary to change the compiler. I can learn the syntax from the book. If you want to search, you have to search for "ostream overloading writing method" and then compare the codes. If it is a very deep template usage, the copy syntax error message search will not be able to find out the reason.
阿神2017-04-18 10:53:30
The error message the compiler gives you is very clear. Maybe you can’t read English. Don’t worry about which compiler to choose, the compiler is innocent, gcc is pretty good