Studio 11 compile old code issue
I have an old file which can successfully compile with forte6.2. But when I tried to compile with Studio 11, I encountered the following errors.
[exec] /opt/tools/wh/dtd/sparc-SunOS5/sunstudio/11/SUNWspro/bin/CC -Xa -G -I/vobs/project/thirdparty/current_jdk/solaris/include -I/vobs/project/thirdparty/current_jdk/solaris/include/solaris com/cooperation/service/security/OperatingSystemUserAuthentication.c -o /vobs/cooperation/rtdir/lib/sparc/libUserAuth.so
[exec] CC: Warning: Option -Xa passed to ld, if ld is invoked, ignored otherwise
[exec] "com/cooperation/service/security/OperatingSystemUserAuthentication.c", line 59: Error: Pointer type needed instead of JNIEnv_.
And line 59 is:
(*jenv_)->ReleaseStringUTFChars(jenv_, userId_, USER_NAME_PTR);
Any idea, why this cannot be compiled under Studio 11?
[855 byte] By [
icesummit] at [2007-11-26 11:26:52]

# 1
SIde note: What do you expect the -Xa option to do? It is not an option recognized by the C++ compiler nor by the linker.
You did not provide enough context to evaluate the error message. The compiler expects one of the identifiers in the expression to have a pointer type, but the identifier has type JNIEnv_, which apparently is not a pointer type.
Among the possible reasons for the change in compiler behavior:
1. the source code changed
2. command-line options changed, affecting the interpretation of the source code
3. the source code tests for a compiler version, and the different compiler version caused the source code to be interpreted differently
4. bug in one of the compilers
You can test for the first 3 cases by verifying that the code compiles when you use FD6u2 but change nothing else. If so, compile with -E instead of -G using each compiler, directing the output to a file. Compare the outputs.
CC5.3 <opttions> -E file.c >& file-5.3.i
CC5.8 <opttions> -E file.c >& file-5.8.i
diff file-5.3.i file-5.8.i
Differences relating to any of the identifiers in line 59 or the definitions of their types could explain the difference in results.
Otherise, if you can provide a code sample that can be compiled except for that one error message, I could say more.