![]() |
[c++] What's this error?
What does this error mean?
Undefined first referenced symbol in file operator<<(std::basic_ostream<char, std::char_traits<char> >&, Diamond&)/var/tmp//ccR39vYu.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status I'm trying to overload the << operator within a class, and this is the only part that I can't seem to get working. Let me know if you need more code or if you know what I should check out to fix it. Thanks |
Show the the code in question.
|
It's a linker error meaning operator<< with those parameters is not defined. Remember that if you're trying to do something like
Class c; cout << c; the operator<< function must either be a member of ostream or a global function. If you make it a member of Class it's not going to work the way you expect. |
What nonsensical is basically saying is put it as a global function in your header file (not part of the class) and then make that function a friend of your class to get private access.
|
All times are GMT -8. The time now is 12:44 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project