所以我使用 MinGW 作为 Windows 的 C 编译器,我制作了一个简单的 C 程序
#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;
}
所以我使用命令...
gcc -o test.o test.c -I"\..\Program Files (x86)\Pixie\include"-L"\..\Program Files (x86)\Pixie\lib"- LRI
确定预编译器的包含文件在哪里......以及链接器的库在哪里
我收到以下错误
:\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
我试图查看是否错过了链接库,但是……我没有看到 然而,缺少的引用位于 .h 文件中
有人有什么建议吗?
最佳答案
我能够找到解决此问题的方法......我查看了 ri.h 的源文件 并找到常量被初始化的内容。 RI_P 为“P” RI_BILINEAR 为“双线性”
我变了
RiPatch (RI_BILINEAR,RI_P,(RtPointer)Square,RI_NULL);
至
RiPatch ("bilinear","P",(RtPointer)Square,RI_NULL);
这使我能够编译 c 文件并 RNDR 图像。
关于编译一个简单的C程序以使用Pixie进行渲染(开源renderman),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16975567/