This is a discussion on problem with default constructor of global object on AIX with xlc 5.0 within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi, I have a simple code: ================================================== #include <iostream.h> class InstructionSet { public: InstructionSet() { cerr << "InstructionSet CONSTRUCTOR\n"; ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I have a simple code: ================================================== #include <iostream.h> class InstructionSet { public: InstructionSet() { cerr << "InstructionSet CONSTRUCTOR\n"; } ~InstructionSet() { cerr << "InstructionSet DESTROYED\n"; } }; InstructionSet globalInstructionSet; int main(int argc, char * argv[]) { cerr << "main\n"; return 0; } ================================================== When I built and ran this on IBM AIX with xlc version 5, I got main But on the other UNIX platforms (HP, SGI, Alpha, Linux, SUN), I got InstructionSet CONSTRUCTOR main InstructionSet DESTROYED Do you know why the Aix build is not calling the default constructor? The build commands on Aix are Compiling rdc.cpp xlc -q64 -O2 -DAIX5 -DRS64 -DRS6000 -qnolm -DUSE_AIX_LOCAL -c -o rdc.o rdc.cpp -I. -Iunix -I../../include/ Creating rdc xlc -q64 -O2 -DAIX5 -DRS64 -DRS6000 -qnolm -DUSE_AIX_LOCAL -o rdc rdc.o -bh:4 -bpT:0x10000000 -bpD:0x200000 -L. -L../../bin/ -lbsd -q64 -lpthreads -lC -lC -lc -lxlf90 -lm Many thanks in advance, Chris |
| |||
| "ChrisG" <arcticdream00@yahoo.com> writes: > Do you know why the Aix build is not calling the default constructor? Because you are not building your executable correctly. > xlc -q64 ... -q64 -lpthreads -lC -lC -lc -lxlf90 -lm Never do this ^^^^^^^^^^^^ Instead, use appropriate compiler driver ('xlC' in this case) to link your executables. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Posted By | For | Type | Date | |
| AIX Operating System [Archive] - Page 17 - Unix Technical Forum | This thread | Refback | 07-01-2008 02:59 AM | |