Macha Posted August 13, 2010 Share Posted August 13, 2010 I just discovered the inlinecpp module. Soooo....I have no clue really. I tried typing the help example into a Python operator: # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. import inlinecpp mymodule = inlinecpp.createLibrary( name="cpp_string_library", includes="#include <UT/UT_String.h>", function_sources=[ """ int matchesPattern(const char *str, const char *pattern) { return UI_String(str).multMatch(pattern); } """]) but all I get is a lot of black command line windows popping up. I am sure I don't approach this right. Can somebody enlighten me as to what is happening? Quote Link to comment Share on other sites More sharing options...
graham Posted August 13, 2010 Share Posted August 13, 2010 (edited) The problem is that your C++ code is failing to compile because you have a couple of syntax errors. You are returning a UI, not UT string, and calling multMatch, not multiMatch. I'm guessing the popup windows might be attempts to output the compiler stack trace, not sure though. Personally I'd suggest placing your inlinecpp function stuff not in the cook code section. I always put mine in either the PythonModule or I create an extra section and compile that to a submodule of the PythonModule. However, it will work when it is in there. Just a matter of housekeeping I suppose. Edited August 13, 2010 by graham Quote Link to comment Share on other sites More sharing options...
Macha Posted August 13, 2010 Author Share Posted August 13, 2010 You are right, I had some typos in there and corrected them. The problem remains though and I still get the black windows popping up and an error on the SOP. Unfortunately I cannot see what the error is because when I try to middle-click I get a quick flash of a black window and that's it. I used this code example: http://www.sidefx.com/docs/houdini11.0/hom/extendingwithcpp Do I need to have some other stuff installed? Indentation error? If my fly-eyes aren't mistaken I believe I can read hcustom.exe on that window. Quote Link to comment Share on other sites More sharing options...
Macha Posted August 13, 2010 Author Share Posted August 13, 2010 This inlinecpp stuff is Houdini specific? Meaning, I can't test it externally in another editor with just Python running? Quote Link to comment Share on other sites More sharing options...
graham Posted August 13, 2010 Share Posted August 13, 2010 (edited) I copied and pasted your code exactly, fixing those two typos and it worked for me fine afterwards. I was also having problems getting the error messages from the SOP since MMB was causing it to recook and fail instantly. I used print hou.Node.errors() on it to get the error message to help me fix the problem. I don't think you need to have anything special installed though I've never tested it on Windows. Edited August 13, 2010 by graham Quote Link to comment Share on other sites More sharing options...
Macha Posted August 13, 2010 Author Share Posted August 13, 2010 (edited) Thanks, I didn't know about errors(). Looks like an environment variable not set? It gives me this: Error: Python error: Traceback (most recent call last): File "<stdin>", line 20, in <module> File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", l ine 723, in createLibrary acquire_hom_lock) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", l ine 156, in __init__ includes, function_sources, debug, catch_crashes, acquire_hom_lock) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", l ine 177, in _load self._compile() File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", l ine 270, in _compile self._run_compile_command(command) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", l ine 286, in _run_compile_command raise CompilerError(command + "\n" + stdout_data) CompilerError: hcustom -i C:/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp C:/D OCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp/cpp_string_library_Windows_x86_11. 0.466_cI2OgCqBY5wJVZLXC5cAnQ.C MSVCDir environment variable not set. Please set it and try again. Ho, I need a compiler! I can feel it, this is going to be a day brimming with dashing, radiant, positive intelligence. Edited August 13, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted August 13, 2010 Author Share Posted August 13, 2010 (edited) Hmmm. I downloaded and installed Visual C++ Express. I set the environment variable: MSVCDir D:\Program Files\Microsoft Visual Studio 10.0\VC But I get this error now: Error: Python error: Traceback (most recent call last): File "<stdin>", line 20, in <module> File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", line 723, in createLibrary acquire_hom_lock) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", line 156, in __init__ includes, function_sources, debug, catch_crashes, acquire_hom_lock) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", line 177, in _load self._compile() File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", line 270, in _compile self._run_compile_command(command) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.466/houdini/python2.6libs\inlinecpp.py", line 286, in _run_compile_command raise CompilerError(command + "\n" + stdout_data) CompilerError: hcustom -i C:/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp C:/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp/c pp_string_library_Windows_x86_11.0.466_cI2OgCqBY5wJVZLXC5cAnQ.C Making 'C:/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp/cpp_string_library_Windows_x86_11.0.466_cI2OgCqBY5wJVZLXC5cAnQ.o' and 'C:/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp\cpp_string_library_Windows_x86_11.0.466_cI2OgCqBY5wJVZLXC5cAnQ.dll' from 'C :/DOCUME~1/takano/MYDOCU~1/houdini11.0/inlinecpp/cpp_string_library_Windows_x86_11.0.466_cI2OgCqBY5wJVZLXC5cAnQ.C' Edited August 13, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Ratman Posted August 13, 2010 Share Posted August 13, 2010 Last time I checked, you can't use VS Express with the HDK, oh and it has to be 2005, not 2010. Quote Link to comment Share on other sites More sharing options...
petz Posted August 13, 2010 Share Posted August 13, 2010 as ratman said you´ll need the vc 2005 compiler since the inlinecpp code get compiled using hcustom. the compiler is included in the windows sdk. so try searching the net for either sdk 6.0 or 6.1 if i remember corretly. petz Quote Link to comment Share on other sites More sharing options...
Macha Posted August 16, 2010 Author Share Posted August 16, 2010 Hm. Does anybody have a link to the correct sdk for windows xp? I can't seem to find it. According to the docs Express should work, but I have also read in other places that it doesn't. I have eternal trouble "getting into" C++. I always stumble at the install-the-correct-sequence-of-amazingly-numerous-versions-of-many-things-but-haha-that-didn't-work-with-your-particular-setup step. I'm beginning to wonder if there is a worldwide C++ programmer's conspiracy to shroud themselves in mystery, smoke and mirrors. Or perhaps it really is very difficult stuff and you are a superbly clever bunch. Quote Link to comment Share on other sites More sharing options...
JoshJ Posted August 16, 2010 Share Posted August 16, 2010 hey Macha, you're not the only one, I'm okay with python but I have similar encounters/problems with getting into C++... now especially with the inline python coding it would be great to try it out Quote Link to comment Share on other sites More sharing options...
resonanz Posted August 31, 2010 Share Posted August 31, 2010 I have the same problems Macha had but I cannot get hou.Node().errors() to print the error message. I tried hou.pwd().errors() and all I got is an empty string. It would help me alot if I could see what is going wrong. Thanks! Quote Link to comment Share on other sites More sharing options...
Macha Posted August 31, 2010 Author Share Posted August 31, 2010 I have the same problems Macha had but I cannot get hou.Node().errors() to print the error message. I tried hou.pwd().errors() and all I got is an empty string. It would help me alot if I could see what is going wrong. Here is how I did it: In the Python Shell type something like >>> mynode = hou.node("/obj/box_object1/mySandbox1") >>> mynode.errors() 'Error: Python error: Traceback (most recent call last):\n File "<stdin>", line 5, in <module>\nNameError: name \'xeddx\' is not defined\nError: Python error: Tr aceback (most recent call last):\n File "<stdin>", line 5, in <module>\nNameError: nam e \'xeddx\' is not defined\n' >>> Quote Link to comment Share on other sites More sharing options...
resonanz Posted September 1, 2010 Share Posted September 1, 2010 Thank you Macha! My mistake was to call hou.Node().errors() inside the Python-Sop. Anyway, I cannot get inlinecpp to work no matter what I try. Probably the wrong compiler! Quote Link to comment Share on other sites More sharing options...
Macha Posted January 4, 2011 Author Share Posted January 4, 2011 Old post, new try. I am trying this on a newly installed Ubuntu machine and it still doesn't work. Is there anything I need to download for this to work? I was under the impression there's a c++ compiler by default but perhaps not? Quote Link to comment Share on other sites More sharing options...
pclaes Posted January 4, 2011 Share Posted January 4, 2011 Old post, new try. I am trying this on a newly installed Ubuntu machine and it still doesn't work. Is there anything I need to download for this to work? I was under the impression there's a c++ compiler by default but perhaps not? I haven't tried the inlinecpp yet, but in regards to compiling under linux this might help: http://www.peterclaes.be/blog/?p=67#more-67 There is indeed a c++ compiler, but you will have to check it is the same one as the version of houdini. gcc4.1 is not the same as gcc4.3. You can get the other compilers from the repositories. See if you can compile the starsop. Quote Link to comment Share on other sites More sharing options...
graham Posted January 4, 2011 Share Posted January 4, 2011 You'll have to install a few packages/libraries to get it to work still. Most notably you should first install the build-essential pack to get some of the more fundamental compilation things set up. Can't remember exactly what's in it but as soon as I install Ubuntu I always install it. After that you should then be able to compile, but may get issues with linking against certain libraries. You'll then need to install the corresponding packages for those as well. I don't remember exactly which ones I needed to install but it was ones like x11, xi, gl, glu1. I think they all need to be the -dev version as well. After you get those installed it should be fine. Quote Link to comment Share on other sites More sharing options...
Jason Posted January 4, 2011 Share Posted January 4, 2011 You'll have to install a few packages/libraries to get it to work still. Most notably you should first install the build-essential pack to get some of the more fundamental compilation things set up. Can't remember exactly what's in it but as soon as I install Ubuntu I always install it. After that you should then be able to compile, but may get issues with linking against certain libraries. You'll then need to install the corresponding packages for those as well. I don't remember exactly which ones I needed to install but it was ones like x11, xi, gl, glu1. I think they all need to be the -dev version as well. After you get those installed it should be fine. Would it be fair to say that if you are able to run hcustom effectively against the toolkit samples, then your inlinecpp should work? Quote Link to comment Share on other sites More sharing options...
graham Posted January 4, 2011 Share Posted January 4, 2011 Yes, it compiles the code using hcustom so if it works then inlinecpp should be fine. http://www.sidefx.com/docs/houdini11.0/hom/extendingwithcpp#errors_and_warnings Quote Link to comment Share on other sites More sharing options...
Macha Posted January 11, 2011 Author Share Posted January 11, 2011 I installed the build essentials but I still can't get it to work. I've actually asked Side Effects support about this several times but I get no replies. It probably doesn't fall under the support licence. Does anybody have a list of exactly what is required to install? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.