Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [c++] What's this error? (https://thetfp.com/tfp/tilted-technology/75456-c-whats-error.html)

j0hnb 11-09-2004 07:52 AM

[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

MXL 11-09-2004 05:34 PM

Show the the code in question.

n0nsensical 11-09-2004 11:17 PM

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.

Rekna 11-10-2004 08:18 AM

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 04:05 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46