gcc-3.2.3 with -ansi and 32bit gcc-3.2.3 binaries
Crescioli, Phil
Phil.Crescioli@gd-ais.com
Fri Feb 20 21:33:00 GMT 2004
All,
My Platform is Sun Ultra Sparc 3e with Solaris 8 and GCC3.2.3.
I must be ansi/iso compliant and use -ansi when compiling.
I have the following program:
#include <iostream>
#include <fstream>
#include <procfs.h>
#include <unistd.h>
using namespace std;
int main(void)
{
int pid_ ;
cout << "Entering Main()" << endl ;
// Get this processes Process IDentification (PID)
pid_ = getpid();
cout << "My Process ID is: " << pid_ << endl ;
cout << "Exiting Main()" << endl ;
return (0);
}// main
It compiles and runs using the gcc323 command:
[langley]:/home/philc/GCC/test> g++ -o proc proc.cpp
[langley]:/home/philc/GCC/test> proc Entering Main()
My Process ID is: 2058
Exiting Main() [langley]:/home/philc/GCC/test>
Previously Lyle(thanks!) pointed out that if I build using -m64
and point to the 64 bit gcc323 libs it will work. And that it it does.
[langley]:/home/philc/GCC/test> g++ -ansi -m64 -o proc proc.cpp
[langley]:/home/philc/GCC/test> proc
Entering Main()
My Process ID is: 2076
Exiting Main()
[langley]:/home/philc/GCC/test>
Unfortunatley I need to stay with the 32bit gcc323 libs as well
as remain ansi compliant - so I need to find a way to compile this
program without the -m64.
When I take out the -m64, the resulting gcc323 compile time error is:
[langley]:/home/philc/GCC/test> g++ -ansi -o proc proc.cpp
In file included from /usr/include/sys/procfs.h:41,
from /usr/include/procfs.h:26,
from proc.cpp:3:
/usr/include/sys/procfs_isa.h:230: 'uint64_t' is used as a type, but is
not
defined as a type.
In file included from /usr/include/procfs.h:26,
from proc.cpp:3:
/usr/include/sys/procfs.h:304: 'uint64_t' is used as a type, but is not
defined
as a type.
[langley]:/home/philc/GCC/test>
For kicks, and to test further I compiled the same code under gcc-2.95.2
using it's 32bit libs. Without -ansi the code compiled and ran fine.
[langley]:/home/philc/GCC/test>g++ -o proc proc.cpp
[langley]:/home/philc/GCC/test> proc
Entering Main()
My Process ID is: 29677
Exiting Main()
[langley]:/home/philc/GCC/test>
With -ansi the resulting gcc-2952 compile time error is:
[langley]:/home/philc/GCC/test> g++ -ansi -o proc proc.cpp
In file included from /usr/include/sys/procfs.h:41,
from /usr/include/procfs.h:26,
from proc.cpp:3:
/usr/include/sys/procfs_isa.h:230: syntax error before `;'
In file included from /usr/include/procfs.h:26,
from proc.cpp:3:
/usr/include/sys/procfs.h:106: syntax error before `;'
/usr/include/sys/procfs.h:107: syntax error before `;'
/usr/include/sys/procfs.h:108: field `pr_action' has incomplete type
/usr/include/sys/procfs.h:109: syntax error before `;'
/usr/include/sys/procfs.h:138: syntax error before `;'
/usr/include/sys/procfs.h:147: syntax error before `;'
/usr/include/sys/procfs.h:304: syntax error before `;'
[langley]:/home/philc/GCC/test>
So, going back to using gcc3.2.3, I am lead to believe that I might
be able to include a compiler directive (something like -DL32 ?) with
-ansi that will allow this program to compile using the default
32bit gcc binaries.
I have dug into the Solaris8 OS /usr/include/sys files to try to
find whats up - so far no luck. Any thoughts on how to get this program
built with gcc323 and it's 32bit libs using -ansi is appreciated.
Thanks,
Phil Crescioli
Phil.Crescioli@gd-ais.com
More information about the Gcc-help
mailing list