|
View previous topic :: View next topic |
Author |
fatal error C1001: INTERNAL COMPILER ERROR |
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Tue Mar 11, 2008 8:44 pm Post subject: |
|
|
Ah great.
D |
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Tue Mar 11, 2008 5:13 pm Post subject: |
|
|
i have now built the code using vc++ 2008 express.
Thanks |
|
Back to top |
|
|
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Sun Mar 09, 2008 8:15 pm Post subject: |
|
|
Please send me your source code, Thansks
Again, which compile are you using? |
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Fri Mar 07, 2008 11:55 am Post subject: |
|
|
I am still getting the compiler error:
:\datasim\module2\sourcecode\TestVectorSpace.cpp(55) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
----------------------------------------
No, I have not upgraded to VC 2005 express.
I'll do that and re-run. |
|
Back to top |
|
|
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Fri Mar 07, 2008 11:48 am Post subject: |
|
|
What is the problem? Do you get a compile error?
Have you upgraded from VS 2003 to VS2005 Express??!
Description: |
|
Download |
Filename: |
Zuluman1.cpp |
Filesize: |
618 Bytes |
Downloaded: |
107 Time(s) |
|
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Fri Mar 07, 2008 11:13 am Post subject: |
|
|
I am still stuck on this problem.
I have enclosed some more code snippets to shed some light.
-----------------------------------------
//shorten version of the header file
template<typename Type, int N> class VectorSpace
{
// ** Template member functions ** Premultiplication by a field value
template <typename F> VectorSpace<Type, N>
friend operator * (const F& scalar, const VectorSpace<Type, N>& pt);
};
-----------------------------------------------------
//relevant section of cpp file looks like this....
// Premultiplication by a field value
template <typename Type, int N, typename F> VectorSpace<Type, N>
operator * (const F& scalar, const VectorSpace<Type, N>& v)
{
VectorSpace<Type, N> result;
for (int i= v.MinIndex(); i <= v.MaxIndex(); ++i)
{
result[i] = (scalar * v[i]);
}
return result;
}
-----------------------------------------------------------------
//main looks something like this.......
int main()
{
const int N = 3;
VectorSpace<double, N> myArray;
for (int j = myArray.MinIndex(); j <= myArray.MaxIndex(); j++)
{
myArray[j] = double (j);
}
// This is the section of cold that the error points at
//*********************************************************
const double factor = 0.5;
VectorSpace<double, N> myArray4 = factor * myArray;
//********************************************************
return 0;
}
-----------------------------------------------------
does anyone have any ideas what i am doing wrong??? |
|
Back to top |
|
|
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Wed Mar 05, 2008 1:50 pm Post subject: |
|
|
// Calling a template member function (operator)
double factor = 0.5;
VectorSpace<double, N> myArray4 = factor * myArray;
--------------------------------------------------------------------
I assume that because myArray4 and myArray have the same value of N,
the above assignment should be possible.
yes, in the assignment, Array4 must get the same size as that of Array. Then it should be fine, yes? |
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Wed Mar 05, 2008 1:01 pm Post subject: |
|
|
Thanks.
The code below has been commented out in my code.
----------------------------------------------------------------
/* This code will not compile, no conversions between
the two different classes
const int N1 = 3;
const int N2 = 4;
VectorSpace<double, N1> ArrOne;
VectorSpace<double, N2> ArrTwo;
ArrOne = ArrTwo;
ArrTwo = ArrOne;
*/
---------------------------------------------------------------------
My code is only dependent on one value of N.
i.e const int N = 3;
VectorSpace<double, N> myArray;
for (int j = myArray.MinIndex(); j <= myArray.MaxIndex(); j++)
{
myArray[j] = double (j);
}
// Calling a template member function (operator)
double factor = 0.5;
VectorSpace<double, N> myArray4 = factor * myArray;
--------------------------------------------------------------------
I assume that because myArray4 and myArray have the same value of N,
the above assignment should be possible. |
|
Back to top |
|
|
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Wed Mar 05, 2008 10:19 am Post subject: |
|
|
/* This code will not compile, no conversions between
the two different classes
const int N1 = 3;
const int N2 = 4;
VectorSpace<double, N1> ArrOne;
VectorSpace<double, N2> ArrTwo;
ArrOne = ArrTwo;
ArrTwo = ArrOne;
*/
Hi
YES, the compiler gives rightly an error because TWO different classes are generated (based on the N1 and N2). And in general, you cannot assign two objects of different classes.
Hope this helps
VS 2003 is OK bit 2005 express is much better. I advise downloading Express edition |
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Tue Mar 04, 2008 10:24 pm Post subject: |
|
|
i) I am using microsoft visual studio .net 2003
--------------------------------
ii) below is the code for main
#include "VectorSpace.cpp"
#include "VectorSpaceMechanisms.cpp"
#include <iostream>
using namespace std;
int main()
{
const int N = 3;
VectorSpace<double, N> myArray;
// All elements in vector have the same value, 2.2
double value = 2.2;
VectorSpace<double, N> myArrayB(2.2);
for (int j = myArray.MinIndex(); j <= myArray.MaxIndex(); j++)
{
myArray[j] = double (j);
}
print(myArray);
print(myArrayB);
/* This code will not compile, no conversions between
the two different classes
const int N1 = 3;
const int N2 = 4;
VectorSpace<double, N1> ArrOne;
VectorSpace<double, N2> ArrTwo;
ArrOne = ArrTwo;
ArrTwo = ArrOne;
*/
VectorSpace<double, N> myArray1 = - myArray;
VectorSpace<double, N> myArray2 = myArray; // No other size works!!
VectorSpace<double, N> myArray3 = myArray2 - myArray;
print(myArray1);
print(myArray2);
print(myArray3);
// Calling a template member function (operator)
double factor = 0.5;
VectorSpace<double, N> myArray4 = factor * myArray;
print(myArray4);
double ip = myArray.innerProduct(myArray2);
cout << "Inner product: " << ip << endl;
VectorSpace<double, N> myArray5(myArray);
print(myArray5);
// Addition
double offset = 1.0;
myArray5 = myArray - offset; // try +
print(myArray5);
myArray5 = myArray - myArray; // try -
print(myArray5);
double cp = myArray.componentProduct();
cout << "Product: " << cp << endl;
return 0;
}
-------------------------------
iii) below is the relevant code in vectorspace.cpp
template <typename Type, int N, typename F> VectorSpace<Type, N>
operator * (const F& scalar, const VectorSpace<Type, N>& v)
{
VectorSpace<Type, N> result;
for (int i= v.MinIndex(); i <= v.MaxIndex(); ++i)
{
result[i] = (scalar * v[i]);
}
return result;
} |
|
Back to top |
|
|
Cuchulainn
Joined: 18 Dec 2006
Posts: 318
Location: Amsterdam, the Netherlands
|
Posted: Sat Mar 01, 2008 6:49 pm Post subject: |
|
|
First of all, this is an easy-to-solve problem. Questions:
1. Are you using VC++ 6.0 (if so, you should download FREE Visual Studio Express)
2. Pls post the code of main() so that I can test it.
3. What is the value of N?
VectorSpace<double, N> myArray4 = factor * myArray;
Thanks
PS This nasty error message is caused in 99.999% of cases by a missing < , > or somehing like that! |
|
Back to top |
|
|
zuluman
Joined: 02 Feb 2008
Posts: 6
|
Posted: Sat Mar 01, 2008 11:16 am Post subject: fatal error C1001: INTERNAL COMPILER ERROR |
|
|
hi,
i am trying to put together code modules for module2, but i keep coming up with an error message when building it.
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information.
------------------------------------------------------------
The error seems to point at the following code
VectorSpace<double, N> myArray4 = factor * myArray;
-------------------------------------------------------
The code modules I am putting together come from Daniel Duffy's intro to c++ for fin engineers.
any ideas of what i may be doing wrong.
thanks |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|