Compiling...
overlaod.cpp
d:\vc work\cpp\think_in_cpp\chapter10\overlaod.cpp(17) : fatal error
C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more
information
Error executing cl.exe.
overlaod.obj - 1 error(s), 0 warning(s)
when compiling, errors above will apear.I am a newbie in C++, I hope
someone here can help me.Following is my source code
#include <iostream>
using namespace std;
class myOverload
{
public:
myOverload(float a, float b)
{
x = a;
y = b;
}
myOverload operator=(const myOverload qq)
{
return myOverload(x = qq.x, y = qq.y);
}
friend const myOverload operator+(const myOverload &m, const
myOverload &n);
void myprint()
{
cout << "here is a complex: \n" << x << "+" << y << "i" << endl;
}
private:
float x;
float y;
};
myOverload const operator+(const myOverload &m, const myOverload &n)
{
return myOverload(m.x + n.x, m.y + n.y);
}
int main()
{
myOverload AA(1.3f, 2.6f);
myOverload BB(1.7f, 0.4f);
myOverload CC = AA + BB;
CC.myprint();
return 0;
} 10 8974
LZXIA wrote: Compiling... overlaod.cpp d:\vc work\cpp\think_in_cpp\chapter10\overlaod.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Error executing cl.exe.
overlaod.obj - 1 error(s), 0 warning(s)
when compiling, errors above will apear.I am a newbie in C++, I hope someone here can help me.Following is my source code
Internal error usually has nothing to do with your code. Try to compile
a minimum program (ie. int main(){}) and see if the error persist. You
might need to reinstall your compiler. #include <iostream>
using namespace std;
class myOverload { public: myOverload(float a, float b) { x = a; y = b; } myOverload operator=(const myOverload qq) { return myOverload(x = qq.x, y = qq.y); } friend const myOverload operator+(const myOverload &m, const myOverload &n); void myprint() { cout << "here is a complex: \n" << x << "+" << y << "i" << endl; } private: float x; float y; };
myOverload const operator+(const myOverload &m, const myOverload &n) { return myOverload(m.x + n.x, m.y + n.y); }
int main() { myOverload AA(1.3f, 2.6f); myOverload BB(1.7f, 0.4f); myOverload CC = AA + BB; CC.myprint();
return 0; }
Your code compiled fine with both g++ and cl on my machine.
Regards,
Ben
I think there must be some probelm in my VC6.0. Thanks.
LZXIA wrote: I think there must be some probelm in my VC6.0. Thanks.
Many! It's also very old.
--
Ian Collins.
"LZXIA" writes: Compiling... overlaod.cpp d:\vc work\cpp\think_in_cpp\chapter10\overlaod.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Error executing cl.exe.
overlaod.obj - 1 error(s), 0 warning(s)
when compiling, errors above will apear.I am a newbie in C++, I hope someone here can help me.Following is my source code
#include <iostream>
using namespace std;
class myOverload { public: myOverload(float a, float b) { x = a; y = b; } myOverload operator=(const myOverload qq) { return myOverload(x = qq.x, y = qq.y); } friend const myOverload operator+(const myOverload &m, const myOverload &n); void myprint() { cout << "here is a complex: \n" << x << "+" << y << "i" << endl; } private: float x; float y; };
myOverload const operator+(const myOverload &m, const myOverload &n) { return myOverload(m.x + n.x, m.y + n.y); }
int main() { myOverload AA(1.3f, 2.6f); myOverload BB(1.7f, 0.4f); myOverload CC = AA + BB; CC.myprint();
return 0; }
It compiles and runs OK for me on DevC. Prints 3 + 3i. It looks like your
problem has something to do with VC.
FWIW note that C and C++ programmers rarely use float, they almost always
use double. If they had a huge matrix they might put it in external storage
as a float but re-fluff it when they went to use it. The transcendental
functions and such like work on double.
If I were in your place, I would tuck the problem in the back of my mind and
go on about my business
> Compiling... overlaod.cpp d:\vc work\cpp\think_in_cpp\chapter10\overlaod.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Error executing cl.exe.
overlaod.obj - 1 error(s), 0 warning(s)
when compiling, errors above will apear.I am a newbie in C++, I hope someone here can help me.Following is my source code
Your code compiled fine for me with vc6sp5. If you aren't able
to upgrade your compiler, you can at least get the service pack
which should help out some.
In message <6m*****************@tornado.socal.rr.com>, pillbug
<_p******@socal.rr.com> writes Compiling... overlaod.cpp d:\vc work\cpp\think_in_cpp\chapter10\overlaod.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Error executing cl.exe. overlaod.obj - 1 error(s), 0 warning(s) when compiling, errors above will apear.I am a newbie in C++, I hope someone here can help me.Following is my source code
Your code compiled fine for me with vc6sp5. If you aren't able to upgrade your compiler, you can at least get the service pack which should help out some.
One possible cause of "internal compiler error" with VC++ is the wrong
kind of line separators - which obviously won't show up when other
people cut and paste from a news client to their compilers.
Was any of the code ported from a Unix system?
--
Richard Herring One possible cause of "internal compiler error" with VC++ is the wrong kind of line separators - which obviously won't show up when other people cut and paste from a news client to their compilers.
Now that helped me a lot with some old code I could not compile for
some stupid reason. Now it works, thanks a lot!
it probably doesn't like the friend function or the odd const, try this:
#include <iostream>
using namespace std;
class myOverload
{
public:
myOverload(float a, float b)
{
x = a;
y = b;
}
myOverload operator=(const myOverload & qq) //<<
{
return myOverload(x = qq.x, y = qq.y);
}
friend const myOverload operator+(const myOverload &m,
const myOverload &n);
void myprint()
{
cout << "here is a complex: \n" << x << "+" << y << "i"
<< endl;
}
private:
float x;
float y;
};
// or here with the odd const
myOverload /* const */ operator+(const myOverload &m, const myOverload &n)
{
return myOverload(m.x + n.x, m.y + n.y);
}
int main()
{
myOverload AA(1.3f, 2.6f);
myOverload BB(1.7f, 0.4f);
myOverload CC = AA + BB;
CC.myprint();
return 0;
}
LZXIA wrote: I think there must be some probelm in my VC6.0. Thanks.
Probably. Ask in their groups, get a (free?) upgrade, and finally,
check
if your disk is full. VC6 chokes on that (it's not the only one, but
it's
rather unhelpful about it)
HTH
Michiel Salters
Try cleaning your project. I have had this problem many times before.
Most of the times, cleaning the project and other dependecies fixes it.
Clean Rebuild All. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: paul calvert |
last post by:
I hope somewhere here has encountered and solved a similar problem in
the past.
1) on a new Win2000 PC:
installed Visual C++ 6.0
download & install single file Service Pack 5.0
2) try to...
|
by: JimmyS |
last post by:
I am getting this error ..
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\stl_alloc.h(305) : fatal error C1001: INTERNAL COMPILER
ERROR (compiler file 'msc1.cpp', line 2701)...
|
by: Marco Nova |
last post by:
Hello
I'm using the latest version of Visual Studio 2003 version 7.1.3088, .net framework 1.1.4322 and I've some problem compiling a project, it give me the error
...
|
by: PufferFish |
last post by:
Hi folks,
I hope that this is the correct group for these things, apologies if not.
I've got a strange compiler error. It appears to be similar to the issue
described in knowledgebase...
|
by: cgparis |
last post by:
Dear forum members,
I am trying to compile C++ code under MS Visual Studio .NET 2003,
which references the latest Xerces C++ release library (2.6.0). This
Xerces release was made available...
| |
by: Itjalve |
last post by:
This gives me a fatal error.
I'm using .NET VC7.1 and made a win32 consol app, I have no problems with
VC6. Debug build.
I have removed nearly all my code this is whats left. From the beginning...
|
by: ARF |
last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting
fatal compiler errors.
I start with a default C++/CLR class library project and modify it by adding
the following...
|
by: ishbuu |
last post by:
Hi all.
I've been trying to get a program I wrote on my old machine to compile
on this one, but VS2k5 hasn't been able to finish the thing. I was
using the same operating system/hardware/version...
|
by: kvarada |
last post by:
Hello Experts,
I am building my application on WinNT.4.0_i386_MSVC.7.1 platform. When I build the application on a stand alone machine, it builds fine. But when I build the same application from a...
|
by: Anonymous |
last post by:
My code has suddenly stopped compiling after some refactoring I carried
out last week. I am using VC8 on W2K professional
I get the following cryptic error:
Error 77 fatal error C1001: An...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |