C++ Preprocessor Memory Fault

Hi

Have a problem on with C++ preprocessor. After calling g++ -E main.cpp I get Memory fault (core dumped). C preprocessor works fine. Also QCC -E -Y _gpp main.cpp completes without errors. WTF?

QNX vmware 6.3.0 2004/04/29-21:23:19UTC x86pc x86
g++ (GCC) 3.3.1 (qnx-nto)

I’ve never seen 3.3.1. I only have 2.95.3 and 3.3.5 on my QNX 6.30 system.

My guess is that qcc and g++ are using different versions of the compiler. I’ve personally never used g++ from the command line, I only use qcc.

if you do a qcc -V from the command line, which is the default GNU compiler listed?
If you do a g++ -dumpversion from the command line what is the default compiler listed?

Tim

Thanks for reply.

qcc -V 3.3.1,gcc_ntox86 (default)

g++ -dumpversion
3.3.1

At least you are using the same versions.

I tried the command ‘g++ -E test.cpp’ on my 6.30 SP3 system on a file that’s about 1000 lines long. It didn’t crash but then I’m not using 3.3.1 either.

Interestingly the only thing it does is simply echo out the file line by line to the screen. Is that what it’s supposed to do?

Maybe it crashes if your file is too large or contains a funny character. It may be core dumping under qcc as well but since qcc is running g++ in the background you may not be aware of it (you’d need to have dumper running and clear /var/dumps and then run the qcc command and see if a dump file gets created for g++).

Tim

Yes, it should simply echo out the file line by line. I’m using very small file with a few lines of code so it can’t be a reason of crashing.

I dunno then. Something’s definitely broken in 3.3.1.

The question is does it really matter that much? You can easily accomplish what you want with qcc.

Tim

Sure, you are right but this error is annoying during compiling some FOS software and probably can be the reason of failed compilation. Anyway, thanks for the help.