By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

fatal error C1001: INTERNAL COMPILER ERROR

P: n/a
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;
}

Apr 19 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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
Apr 19 '06 #2

P: n/a
I think there must be some probelm in my VC6.0. Thanks.

Apr 19 '06 #3

P: n/a
LZXIA wrote:
I think there must be some probelm in my VC6.0. Thanks.

Many! It's also very old.

--
Ian Collins.
Apr 19 '06 #4

P: n/a
"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
Apr 19 '06 #5

P: n/a
> 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.
Apr 19 '06 #6

P: n/a
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
Apr 19 '06 #7

P: n/a
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!
Apr 19 '06 #8

P: n/a
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;
}
Apr 19 '06 #9

P: n/a
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

Apr 20 '06 #10

P: n/a
RKS
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.

Apr 20 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.