object interface for c++
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Platform-Specific Issues
In working with esql and the C++ object interface under the 7.31 engine, I want to use gcc (rather than cc) for esql compiles, and g++ (rather than CC) for C++ compiles. I am on HP-UX 10.20. After doctoring the esql script, the gcc part seems to work just fine. However, I can't seem to get g++ working with the C++ sample programs. Apparently, I should use the aforementioned esql script to compile C++ programs as well as my C programs? Is this true? Or should I just "g++ myapp.cpp" on the cmd-line? The doc is no help in this area - only the class library is described, not compiling or linking. I doctored the esql script for .cpp compiles, having to add a few include paths (../incl/c++, ../incl/dmi) that informix apparently forgot, but it pukes with: /opt/informix/incl/c++/it.h:85: parse error before `false' /opt/informix/incl/c++/it.h:86: parse error before `true'. Has anyone successfully used g++ rather than CC for object interface C++ compiles on HP-UX?? Any pointers? Thanks Allen Jantzen, DBA Ned Davis Research
allenj wrote: > In working with esql and the C++ object interface under the 7.31 > engine, I want to use gcc (rather than cc) for esql compiles, and > g++ (rather than CC) for C++ compiles. I am on HP-UX 10.20. > > After doctoring the esql script, the gcc part seems to work just fine. > > However, I can't seem to get g++ working with the C++ sample programs. > Apparently, I should use the aforementioned esql script to compile C++ > programs as well as my C programs? Is this true? Or should I just > "g++ myapp.cpp" on the cmd-line? The doc is no help in this area - > only the class library is described, not compiling or linking. G++ has a different object layout from the native compiler, so it also uses a different name mangling scheme to prevent code compiled with G++ from linking with code compiled with the native C++ compiler. Basically, if you want to use C++, you have to use the same C++ compiler as the C++ libraries were compiled with -- you can't switch willy-nilly. > I doctored the esql script for .cpp compiles, having to add a few > include paths (../incl/c++, ../incl/dmi) that informix apparently > forgot, but it pukes with: The ESQL/C compiler is for C code, not C++ code. Therefore it should not include C++ header directories. > /opt/informix/incl/c++/it.h:85: parse error before `false' > /opt/informix/incl/c++/it.h:86: parse error before `true'. That suggests that either the C++ compiler does not have a built-in bool type and the it.h header assumes it does or (more likely) the it.h assumes the C++ compiler does not have a built-in bool type but G++ actually does. > Has anyone successfully used g++ rather than CC for object interface > C++ compiles on HP-UX?? Very unlikely, on HP-UX or any other platform. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>