Jump to content

inlinecpp


Macha

Recommended Posts

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?

Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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 by graham
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by graham
Link to comment
Share on other sites

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 "&lt;stdin&gt;", line 20, in &lt;module&gt;
  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! :P I can feel it, this is going to be a day brimming with dashing, radiant, positive intelligence.

Edited by Macha
Link to comment
Share on other sites

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 "&lt;stdin&gt;", line 20, in &lt;module&gt;
  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'

post-4013-12816779145_thumb.jpg

Edited by Macha
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

  • 3 weeks later...

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

&gt;&gt;&gt; mynode = hou.node("/obj/box_object1/mySandbox1")
&gt;&gt;&gt; mynode.errors()
'Error:       Python error: Traceback (most recent call last):\n  File "&lt;stdin&gt;", line 
5, in &lt;module&gt;\nNameError: name \'xeddx\' is not defined\nError:       Python error: Tr
aceback (most recent call last):\n  File "&lt;stdin&gt;", line 5, in &lt;module&gt;\nNameError: nam
e \'xeddx\' is not defined\n'
&gt;&gt;&gt; 

Link to comment
Share on other sites

  • 4 months later...

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...