Compiling...
overlaod.cpp
d:\vc work\cpp\think_ in_cpp\chapter1 0\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(floa t 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 8983
LZXIA wrote: Compiling... overlaod.cpp d:\vc work\cpp\think_ in_cpp\chapter1 0\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(floa t 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\chapter1 0\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(floa t 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\chapter1 0\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.s ocal.rr.com>, pillbug
<_p******@socal .rr.com> writes Compiling... overlaod.cpp d:\vc work\cpp\think_ in_cpp\chapter1 0\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(floa t 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 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 build my gui and dll projects, whose project, workspace,
source files all resided on network drive mapped to H. The H mapping,
|
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)
when including any files for templates .. #include <fstream> ,
#include <string>, #include <vector>, #include <list> etc...
The funny thing is...
|
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
c:\build\main\.....\methodeInc.h(36) : fatal error C1001: INTERNAL COMPILER ERRO
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual...
|
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 article 320004 except that particular problem was
|
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 recently by the Apache
organization.
I've defined a system variable on windows as follows:
XERCESCROOT: <...>\xerces-c_2_6_0-windows_nt-msvc_60
| |
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 the
template was defined in a .h file, but that has no effect, same error.
I have seen when searching for fatal error that there are some problems...
|
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 references:
acdbmgd.dll
acmgd.dll
the entire source for the default library header file is:
|
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 on my old machine, I
just replaced the Harddrives after my old one with the OS failed. No
matter how many tweaks I make to the build setup it...
|
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 linux box using rsh it gives me the errors below
Microsoft (R) Development Environment Version 7.10.3077.
Copyright (C) Microsoft Corp...
|
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 internal error has occurred in the
compiler. c:\program files\microsoft visual studio 8\vc\include\xmemory 155
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |