编译一个简单的C程序以使用Pixie进行渲染(开源renderman)

标签 c windows compilation rendering renderman

所以我使用 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/

相关文章:

c - 为什么我不能传递链的地址?斯特托尔

windows - Windows 8 可以构建 Windows 10 IoT Core 应用程序吗?

c - 使用 Windows 调试器查看用 C 写入的内存位置?

java - JDK8编译速度慢

java - NetBeans 中 Java 7 的编译问题

ios - HTML5 视频播放时 CALayerInvalidGeometry 异常

c - 如何保留稍后销毁的字符串的内容?

java - 设置为 ReadDirectoryChangesW 打开的目录的最后修改时间

java - 使用 .java 文件编译文件夹并将其打包

c - 返回语句中的奇怪表达式