fatal error C1001: INTERNAL COMPILER ERROR

Discussion in 'C++' started by LZXIA, Apr 19, 2006.

  1. LZXIA

    LZXIA Guest

    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;
    }
    LZXIA, Apr 19, 2006
    #1
    1. Advertising

  2. LZXIA

    osmium Guest

    "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
    osmium, Apr 19, 2006
    #2
    1. Advertising

  3. LZXIA

    benben Guest

    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
    benben, Apr 19, 2006
    #3
  4. LZXIA

    LZXIA Guest

    I think there must be some probelm in my VC6.0. Thanks.
    LZXIA, Apr 19, 2006
    #4
  5. LZXIA

    Ian Collins Guest

    LZXIA wrote:
    > I think there must be some probelm in my VC6.0. Thanks.
    >

    Many! It's also very old.

    --
    Ian Collins.
    Ian Collins, Apr 19, 2006
    #5
  6. LZXIA

    pillbug Guest

    > 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.
    pillbug, Apr 19, 2006
    #6
  7. In message <6ml1g.8687$>, pillbug
    <> 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
    Richard Herring, Apr 19, 2006
    #7

  8. > 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!
    Gernot Frisch, Apr 19, 2006
    #8
  9. LZXIA

    David Welch Guest

    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;
    }
    David Welch, Apr 19, 2006
    #9
  10. LZXIA

    Guest

    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, 2006
    #10
  11. LZXIA

    RKS Guest

    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.
    RKS, Apr 20, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Julian Bowes
    Replies:
    0
    Views:
    677
    Julian Bowes
    Jul 1, 2003
  2. Jeff Kennedy
    Replies:
    0
    Views:
    1,532
    Jeff Kennedy
    Oct 20, 2003
  3. =?Utf-8?B?bS5XYXJk?=

    Internal connection fatal error

    =?Utf-8?B?bS5XYXJk?=, May 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,557
    Ken Cox [Microsoft MVP]
    May 10, 2004
  4. =?Utf-8?B?TWF5?=

    Internal connection fatal error.

    =?Utf-8?B?TWF5?=, Oct 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,075
    =?Utf-8?B?TWF5?=
    Oct 7, 2005
  5. paul calvert
    Replies:
    6
    Views:
    2,154
Loading...

Share This Page