I have these three files and I am obtaining the error message:
NULL Undeclared.
http://rafb.net/p/3u04E569.html
http://rafb.net/p/hfzCT686.html
http://rafb.net/p/oSxr5T24.html
Anyone know why I am getting these errors and how to fix them?
I have these three files and I am obtaining the error message:
NULL Undeclared.
http://rafb.net/p/3u04E569.html
http://rafb.net/p/hfzCT686.html
http://rafb.net/p/oSxr5T24.html
Anyone know why I am getting these errors and how to fix them?
1. NULL is defined in windows.h (maybe in other files too) if I recall.
2. Using NULL is not advised. Just simply write 0 instead. It's even 3 characters less.
Ok so I changed the NULLS to 0's and this is my error message now:
make -k all
Building file: ../CircleList.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"CircleList.d" -MT"CircleList.d" -o"CircleList.o" "../CircleList.cpp"
../CircleList.cpp: In member function `int CircleList<Object>::sizeOfList()':
../CircleList.cpp:28: warning: no return statement in function returning non-void
../CircleList.cpp: In member function `bool CircleList<Object>::isEmpty() const':
../CircleList.cpp:34: warning: no return statement in function returning non-void
Finished building: ../CircleList.cpp
Building target: Project4.exe
Invoking: GCC C++ Linker
g++ -o"Project4.exe" ./CircleList.o
/mingw/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
make: *** [Project4.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project Project 4
your function sizeOfList in file CircleList.cpp doesnt have a return statement.../CircleList.cpp: In member function `int CircleList<Object>::sizeOfList()':
../CircleList.cpp:28: warning: no return statement in function returning non-void
similar error to above error../CircleList.cpp: In member function `bool CircleList<Object>::isEmpty() const':
../CircleList.cpp:34: warning: no return statement in function returning non-void
this one looks like you dont have a function 'int main(...)'/mingw/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
NULL is not defined in <windows.h> (well, may-be there too), but in <cstddef>. This file usually gets included by any other header you include, so most of the time there's no problem if you don't include it yourself.
Ok I got that error to go away but now I'm having a problem in my main.
The error says undefined reference to CircleList<int>::CircleList()
Main File: http://rafb.net/p/C3Y5PO55.html
http://rafb.net/p/T1Se6Z20.html CircleList.h
http://rafb.net/p/sK5dUs41.html CircleList.cpp
http://rafb.net/p/ZnC7nx52.html CircleListNode.h
http://rafb.net/p/Y0VgQc26.html CircleListItr.h
Does anyone know how to fix this error?
it means you dont have a templated constructor for CircleList. your constructor is just defined as 'public CircleList() ...'. you need to do something similar to, say, your find function declaration.
right now you are only allowed to create CircleLists like this: CircleList myList;
not like this:
CircleList<int> myList;