Compiling a simple C program to render with Pixie( open source renderman)

298 views Asked by At

So I am using MinGW as a C compiler for windows I made a simple C program

#include "ri.h"
 RtPoint Square[4] = { { .5,.5,.5} ,{.5,-.5,.5} , {-.5,.5,.5} , {-.5, -.5 , .5}};
 static RtColor Color = {.2,.4,.6};
 int main(){
        RiBegin (" square.rib" );
        RiDisplay ( " square.tif" , "file" ,"rgb" ,RI_NULL);
        RiWorldBegin();
    RiSurface("constant" , RI_NULL);
    RiColor(Color);
    RiPatch (RI_BILINEAR,RI_P,(RtPointer)Square,RI_NULL);
    //RiPatch (RI_BICUBIC,RI_P,(RtPointer)Square,RI_NULL);
    RiWorldEnd();
RiEnd();
return 0;
}   

so I use the command...

gcc -o test.o test.c -I"\..\Program Files (x86)\Pixie\include" -L"\..\Program Files (x86)\Pixie\lib" -lri

to identify where the include files are for the precompiler ... and where the libraries for the linker

I get the following errors

:\Users\Edward\AppData\Local\Temp\ccEERD04.o:test.c:(.text+0x6e): undefined ref
erence to `_imp__RI_P'

C:\Users\Edward\AppData\Local\Temp\ccEERD04.o:test.c:(.text+0x75): undefined ref
erence to `_imp__RI_BILINEAR'

c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: C:\Users\E
dward\AppData\Local\Temp\ccEERD04.o: bad reloc address 0x20 in section `.eh_fram
e'
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: final link
 failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

I tried to look if I might have missed a library for linking but ...none that I see The missing references however are in the .h files

Does anyone have any suggestions?

1

There are 1 answers

0
Hedge7707 On

I was able to find a workaround to this problem .... I looked at the source file for the ri.h and found what the constants were initialized to. RI_P was "P" RI_BILINEAR was "bilinear"

I changed

 RiPatch (RI_BILINEAR,RI_P,(RtPointer)Square,RI_NULL);

to

 RiPatch ("bilinear","P",(RtPointer)Square,RI_NULL);

this allowed me to compile the c file and RNDR the image.