Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Custom Shaders - Compiling with Visual Studio C++ 10.0?

Custom Shaders - Compiling with Visual Studio C++ 10.0?

Anonymous
Not applicable
413 Views
1 Reply
Message 1 of 2

Custom Shaders - Compiling with Visual Studio C++ 10.0?

Anonymous
Not applicable
Hi,

I'm new to custom shading and I'm getting stuck in the compiling stage.

I'm using the Visual Studio compiler on Vista x64. I'm trying to compile a mental ray shader from this site http://www.writingshaders.com/ using the provided instructions. The shader simply takes in a color and sets it to the result pointer.

The error (shown below) comes in the linking stage where I try to make my .dll file. _mi_phen_eval is a function declared in shader.h that is used by mi_eval_color, which I call once in this shader. The error says there is an unresolved external symbol _mi_phen_eval referenced in the shader function, but I don't see how this could happen if I include shader.h and link to shader.lib as specified in mental ray documentation.


C:\Program Files\Autodesk\Maya2013\mentalray\devkit>cl /c /O2 /MD /no
logo /W3 -DWIN_NT -D64 /I"C:\Program Files\Autodesk\Maya2013\mentalray\devkit\in
clude" one_color.c
one_color.c

C:\Program Files\Autodesk\Maya2013\mentalray\devkit>link /nologo /nod
efaultlib:LIBC.LIB /OPT:NOREF /INCREMENTAL:NO /DLL /OUT:one_color.dll one_color.
obj shader.lib
Creating library one_color.lib and object one_color.exp
one_color.obj : error LNK2019: unresolved external symbol _mi_phen_eval referenc
ed in function _one_color
one_color.dll : fatal error LNK1120: 1 unresolved externals


Has anyone else run into this problem?

Thanks!
0 Likes
414 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hi again,

I figured it out. For those who are running into this same problem, make sure you are using the correct compiler. I was compiling on Visual Studio Express which doesn't come with the 64 bit compiler. Once I downloaded the professional version which does have it, I was able to compile with no issues.
0 Likes