• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Operator Overloading works in MSVC but not with GCC?

FoxGaming

Exalted Member
As the title states I have a program that works 100% in MSVC but when compiled with GCC on redhat it's throwing Errors:
Code:
g++ -std=c++0x -c assign26.cpp
assign26.cpp: In function ‘int main()’:
assign26.cpp:62: error: no match for ‘operator<<’ in ‘std::operator<<

here is the code:
Header
Source
Main


yes this is a homework assignment, but I've already done the work but it appears MSVC is cheating somewhere and GCC is being dumb.
 

Tommy

Founder
Lots of code via Date class. I'm unsure of what it is really complaining about. Is it about incrementing and decrementing whilst being in between "<<" or is it the Date class in general? Have you done anything to suppress the error or?
 

FoxGaming

Exalted Member
Lots of code via Date class. I'm unsure of what it is really complaining about. Is it about incrementing and decrementing whilst being in between "<<" or is it the Date class in general? Have you done anything to suppress the error or?

No I haven't done anything, I'm not sure why but when adding an int to a date it's not using the overloaded <<. Other then that I have no clue, MSVC doesn't have any errors or warnings. I know the code is sloppy just trying to get a ton of assignments done as fast as possible lol
 

Rochet2

Moderator / Eluna Dev
The lines were wrong on the error msg and your pastes :p
Try wrapping the date++ inside ( )?
Hmm..
 

FoxGaming

Exalted Member
The lines were wrong on the error msg and your pastes :p
Try wrapping the date++ inside ( )?
Hmm..

Yeah the lines are off, the original source files have these huge headers on the top for our submit application to read, so line 62 that it is referring to is actually line 48 in the paste. xD should have mentioned that.
 
Top