怀疑g 编译器真的比较好吗?为什么我的代码好是编译不过呢?谢谢。进来看看----------------[在线等待]

怀疑g 编译器真的比较好吗?为什么我的代码好是编译不过呢?谢谢。进来看看----------------[在线等待] - 故障解答 - 电脑教程网

怀疑g 编译器真的比较好吗?为什么我的代码好是编译不过呢?谢谢。进来看看----------------[在线等待]

日期:2006-12-05   荐:
怀疑g 编译器真的比较好吗?为什么我的代码好是编译不过呢?谢谢。进来看看----------------[在线等待]#include <iostream>#include <cassert>using namespace std;template<typename T>struct nodeType{ T info; nodeType<T> *link;};template <typename T>class linkedListType{ friend ostream & operator<<(ostream &,const linkedListType<T>&); public: const linkedListType<T> operator=(const linkedListType<T> &); void initializeList(); bool isEmptyList(); int length(); void destroyList(); T front(); T back(); bool search(const T& searchItem); void insertFirst(const T& newItem); void insertLast(const T& newItem); void deleteNode(const T& deleteItem); linkedListType(); linkedListType(const linkedListType<T>& otherList); ~linkedListType(); protected: int count; nodeType<T> *first; nodeType<T> *last; private: void copyList(const linkedListType<T> &);};int main(){ return 0;}==============================Compiler: Default compilerExecuting g .exe...g .exe "F:\C \050415\107.cpp" -o "F:\C \050415\107.exe" -g3 -I"d:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"d:\Dev-Cpp\include\c \3.4.2\backward" -I"d:\Dev-Cpp\include\c \3.4.2\mingw32" -I"d:\Dev-Cpp\include\c \3.4.2" -I"d:\Dev-Cpp\include" -L"d:\Dev-Cpp\lib" -g3 F:\C \050415\107.cpp:15: warning: friend declaration `std::ostream& operator<<(std::ostream&, const linkedListType<T>&)' declares a non-template functionF:\C \050415\107.cpp:15: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warningExecution terminatedCompilation successful-------------------------cl.exe 2003正常编译的?gt;>?br>friend ostream & operator<<(ostream &,const linkedListType<T>&);//这一行有警告。多出警告只能说明g 编译器更优秀,更符合C 标准@chunhai12(苦行僧) -------------那你说我的代码应该如何改正?
标签: