Question:
What would be the problem from these C++ compiler errors?
2009-07-29 14:22:19 UTC
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(23) : error C2365: 'terminate' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 9.0\vc\include\eh.h(58) : see declaration of 'terminate'
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(64) : error C2659: '=' : function as left operand
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(100) : error C2659: '=' : function as left operand
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(140) : error C2659: '=' : function as left operand
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(151) : warning C4551: function call missing argument list
1>c:\users\brandon\documents\visual studio 2008\projects\cs1622assign2\cs1622assign2\main.cpp(181) : error C2659: '=' : function as left operand
1>Build log was saved at "file://c:\Users\Brandon\Documents\Visual Studio 2008\Projects\CS1622Assign2\CS1622Assign2\Debug\BuildLog.htm"
1>CS1622Assign2 - 5 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Three answers:
Ngo Cong Huan
2009-07-29 19:20:57 UTC
the term "terminate" was used and you redefine it. That is the term was pre-declared. So don't you that term, change it to another name.
jplatt39
2009-07-29 14:35:38 UTC
1. You appear to have defined a variable terminate when there was already a terminate(); function.

2. You may assign a function's return to a value thus: var=function();. You may not assign anything to a function as in function()=var;. The compiler reads those errors C2659 as that latter -- with the function on the left hand side of the equals sign. The C4551 just says function call missing argument list. I suspect these all have something to do with the redefinition of terminate() as terminate.
Erika
2016-12-24 18:04:09 UTC
Nasty, nasty C++'ism. subject concerns initiate to bypass incorrect precise here: SortedType a2(intList); SortedType have not got a constructor that takes a SortedType as a parameter (reproduction constructor). So the compiler generates one for you. It does a shallow reproduction of each and each difficulty in intList into a2. So now listData in intList and a2 the two ingredient to an comparable record. The pointer become copied. The record wasn't. Then, in the previous you are able to pass out important, C++ is going to call the destructor for intList and a2. they're indoors of sight form variables declared on the stack, so the destructor desires to be run to unwind the function. So: SortedType::~SortedType() gets observed as 2 circumstances. as quickly as for intList, returned for a2. And in the two situations listData factors to an comparable acceptable record. the 1st call frees each and each and each and all of the nodes indoors the acceptable record. In a Debug build with Microsoft VS, no longer in straight away forward words does it loose the memory, it fills the memory, with a cost of 0xfeeefeee. Then the C'tor gets observed as a 2d time. yet now the subsequent pointer on your acceptable record nodes incorporate 0xfeeefeee. and that's the placement you fault. feeefeee isn't a valid pointer. in case you will use a replica constructor, and your form is composed of pointer variables, you % to enforce the reproduction C'Tor your self. the only the compiler generates could % to no longer artwork. thank you for reminding me why i appreciate C#. This crud would not take place ;-) playstation : DeleteItem fails miserably if the object isn't indoors the record. you are able to desire to guard destructive to that.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...