S
sreak
Need to find the cause of the following error:
The sample code goes as follows
file name version.cpp )
#include <iostream>
struct version
{
int val;
};
int main()
{
version Test;
Test.val=0;
return (0);
}
Compilation environment:
Sun Forte 7 Developer, CC version 5.4
Observation:
* /opt/SUNWspro/bin/CC version.cpp ( By default the -compat is 5 )
"version.cpp", line 3: Error: version is not a structure tag.
* /opt/SUNWspro/bin/CC -compat version.cpp ( This means -compat=4 )
No Error, compilation suzzessful
* When you don't include <iostream>, there is no problem with -compat=5
also.
* When any other structure tag is used, thgere is no error.
Is it because there is some funtiion, datatype already included in
the standard library with the name "version"? C++ puts the structure
tags and other dataTypes in same namespace.
The sample code goes as follows
#include <iostream>
struct version
{
int val;
};
int main()
{
version Test;
Test.val=0;
return (0);
}
Compilation environment:
Sun Forte 7 Developer, CC version 5.4
Observation:
* /opt/SUNWspro/bin/CC version.cpp ( By default the -compat is 5 )
"version.cpp", line 3: Error: version is not a structure tag.
* /opt/SUNWspro/bin/CC -compat version.cpp ( This means -compat=4 )
No Error, compilation suzzessful
* When you don't include <iostream>, there is no problem with -compat=5
also.
* When any other structure tag is used, thgere is no error.
Is it because there is some funtiion, datatype already included in
the standard library with the name "version"? C++ puts the structure
tags and other dataTypes in same namespace.