disable MSVC++ preprocessor


#1

every time I try to compile a renderman .sl file with an #include.h file I got the error…

[i]myinclude.h, line 1: ERROR: parse error [/i]
[b][/b]

this is probably due to the fact that MSVC++ intercepts and preprocess the file but the output is not so good for the shader.exe… my little question is… how can I disable that preprocessing from MSVC++ and let the shader.exe do it by herself ?

edited:: the true is that I donno what shader.exe uses to preprocess C files… BMRT with slc.exe uses a targeted cpp.exe to preprocess… I hope that shader.exe does not use the system preprocessor… as it that case probably is just the MSVC++… and so maybe the 7.1(net2003) is not supported by renderman.

ciao
francesca


#2

Are you using VC++ as an IDE for shader development? How have you got your project set up for that?


#3

I’m used to use VC++ for mentalray shaders developing… but not for renderman shaders developing because there’s nothing it can does for prman. I think I have some sort of conflict with the preprocessing fase when I call the shader.exe… the compiler for prman shaders.

even if I already shared the source for some of my mr shaders… maybe there’s not also the project files… if you have MSCV++ net2003 I can send you the files… no problem.

but for the moment I cannot resolve the prman issue, that’s my problem … :scream:

ciao
francesca


#4

Well that’s the thing. I would advise you to save your .sl file somewhere, then run


shader.exe myshader.sl

from the command prompt


#5

not 100% sure so…

BMRT shader.exe will use whichever cpp is available in the path first

prman uses it’s own pre-processor

can you paste the shader code (or at least the lines around the include) ?


#6

prman uses it’s own pre-processor…
the slpp.exe… I have it in the prman/etc folder.

can you paste the shader code…
damn… this happens to me with also all the classic shaders that are on the net… not only I’ve tried on another pc with a fresh install also for prman… without the msvc… same error… actually I cannot compile a shader with an include file… not if it’s only specified on the header and nor if it is also specified in the shader.exe with the -I %path flag or all the combinations we can get…no way… I’m with proserver 11.5.3.

ciao
francesca


#7

i just tried on my laptop (XP pro) with 11.5.3 and a somewhat bogus shader without a problem - i don’t have any MS compiler installed on this machine though.

one of the things you can do is run the C pre-processor (whichever you have), which is going to inline the #include code and then pipe the output to shader.exe :
cpp <myshader.sl> | shader.exe
this is a common trick that many people use to have access to the C++ pre-processor and be able to use more advanced macros and the // type comments.

any chance you could paste the source of a bogus shader and the output of your command line ?


#8

ehy shehbahn… you read in my mind… I was really asking this… anyway I also resolved just leaving the includes in the same directory of the .sl. :)… donno why with the path it gave that errors… but I’m going to try also the your tip. :thumbsup:

ciao
francesca


#9

if your syntax is #include “blah” yes you’ll need to have your includes in the same directory. if you use #include <blah> then the library paths are used. shader.exe has a similar syntax as all the compilers, you can give it a numer of include paths with -I :
shader -I. -I…/include -I<full path to includes> blah.sl

that’s how slim works (you can see the compiling commands in the slim console if you push the notice level to debug iirc)


#10

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.