gcc3.3 and the DPLUGIN macro

When compiling the plugins for Draw Harness, I get an error such as the following:

../../../src/FWOSDriver/FWOSDriver.cxx:12:18: pasting "FWOSDriver" and "::" does not give a valid preprocessing token
make: *** [FWOSDriver.lo] Error 1

I changed the file ros/inc/Draw_PluginMacro.hxx and this change allowed TKTopTest to compile - ?! However FWOSDriver won't compile.

The change I made was to remove the two hashes from name##::Factory leaving name::Factory.

I am compiling everything, not just the plugins; but nothing else uses this macro.

Suggestions?

Thank you
Mark

Mark's picture

P.S. This is Debian Sarge, and I am using make, not wok.

Etienne LORRIAUX's picture

I have the same problem, with gcc-3.3.4-r1 and i've just tried gcc-3.4.3 . I don't really think that the problem comes from gcc.

Regards.

niar's picture

I think, it could be:(
look at
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00586.html

During compilation OC I have done the same as Mark (removed ## from line 21 of OpenCASCADE5.2/ros/inc/Plugin_Macro.hxx) and it works...
afetr this 'fix' FWOSDriver was compiled without any errors...
Regards

Danis's picture

hi nira

I have gotten the following problem
do you have an Idea what is going on?

g++ -DHAVE_CONFIG_H -I. -I. -I../../.. /usr/include -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux /usr/include -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux -MT FWOSDriver.lo -MD -MP -MF .deps/FWOSDriver.Tpo -c ../../../src/FWOSDriver/FWOSDriver.cxx -fPIC -DPIC -o FWOSDriver.lo
g++: cannot specify -o with -c or -S and multiple compilations
make[3]: *** [FWOSDriver.lo] Error 1
make[3]: Leaving directory `/home/bon/OpenCASCADE5.2/ros/adm/make/FWOSPlugin'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/bon/OpenCASCADE5.2/ros/adm/make'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bon/OpenCASCADE5.2/ros'
make: *** [all] Error 2

Thanks

niar's picture

remove path to default headr: "/usr/include" it should look like this:

g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux -MT FWOSDriver.lo -MD -MP -MF .deps/FWOSDriver.Tpo -c ../../../src/FWOSDriver/FWOSDriver.cxx -fPIC -DPIC -o FWOSDriver.lo

the path "/usr/include" is standard system include directory, so you don't have to pu it in command line.

or you can moddify addin -I option before /usr/include:
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I/usr/include -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux -I/usr/include -I/usr/lib/SunJava2-1.4.2/include -I/usr/lib/SunJava2-1.4.2/include/linux -MT FWOSDriver.lo -MD -MP -MF .deps/FWOSDriver.Tpo -c ../../../src/FWOSDriver/FWOSDriver.cxx -fPIC -DPIC -o FWOSDriver.lo

but what for to do this, when the path is ingnored by gcc by default. In both cases it works form me.

it is the problem with yours makefile so check options which you have put on comand line during configuration process, and try to configure it once again.
regards
niar

Danis's picture

Hi Niar,

it wirks well, Thanks for youe help!

Danis

Michael's picture

I don't get it.
What exactly did you do?
./configure ....?

Michael's picture

BTW that's the error I get;
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -Os -march=i686 -pipe -fomit-frame-pointer -DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception -DNDEBUG -DLIN -DLININTEL -MT FWOSDriver.lo -MD -MP -MF .deps/FWOSDriver.Tpo -c ../../../src/FWOSDriver/FWOSDriver.cxx -fPIC -DPIC -o FWOSDriver.lo
../../../src/FWOSDriver/FWOSDriver.cxx:12:18: pasting "FWOSDriver" and "::" does not give a valid preprocessing token
make[3]: *** [FWOSDriver.lo] Error 1
make[3]: Leaving directory `/home/michlmann/Programme/OpenCascade/ros/adm/make/FWOSPlugin'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/michlmann/Programme/OpenCascade/ros/adm/make'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/michlmann/Programme/OpenCascade/ros'
make: *** [all] Error 2

Michael's picture

Got it!

Peter's picture

I've got the same problem. I'm using gcc3.3.5

Making all in FWOSPlugin
make[3]: Entering directory `/usr/local/OpenCASCADE5.2/ros/adm/make/FWOSPlugin'
if /bin/sh ../../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -I/usr/lib/j2sdk1.5-sun/include -I/usr/lib/j2sdk1.5-sun/include/linux -g -O2 -DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception -DNDEBUG -DLIN -DLININTEL -I/usr/lib/j2sdk1.5-sun/include -I/usr/lib/j2sdk1.5-sun/include/linux -MT FWOSDriver.lo -MD -MP -MF ".deps/FWOSDriver.Tpo" \
-c -o FWOSDriver.lo `test -f '../../../src/FWOSDriver/FWOSDriver.cxx' || echo './'`../../../src/FWOSDriver/FWOSDriver.cxx; \
then mv ".deps/FWOSDriver.Tpo" ".deps/FWOSDriver.Plo"; \
else rm -f ".deps/FWOSDriver.Tpo"; exit 1; \
fi
g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../inc -I../../../drv/FWOSDriver -I../../../src/FWOSDriver -I/usr/lib/j2sdk1.5-sun/include -I/usr/lib/j2sdk1.5-sun/include/linux -g -O2 -DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception -DNDEBUG -DLIN -DLININTEL -I/usr/lib/j2sdk1.5-sun/include -I/usr/lib/j2sdk1.5-sun/include/linux -MT FWOSDriver.lo -MD -MP -MF .deps/FWOSDriver.Tpo -c ../../../src/FWOSDriver/FWOSDriver.cxx -fPIC -DPIC -o FWOSDriver.lo
../../../src/FWOSDriver/FWOSDriver.cxx:12:18: pasting "FWOSDriver" and "::" does not give a valid preprocessing token
make[3]: *** [FWOSDriver.lo] Error 1
make[3]: Leaving directory `/usr/local/OpenCASCADE5.2/ros/adm/make/FWOSPlugin'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/OpenCASCADE5.2/ros/adm/make'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/OpenCASCADE5.2/ros'
make: *** [all] Error 2

Peter's picture

after removing ## the program successfully compiled thanks.