[GCC-XML] pygccxml.declarations.matcher.declaration_not_found_t: Unable to find declaration

Vishal Bayskar vishal.bayskar at nechclst.in
Tue Mar 23 02:36:06 EDT 2010


Hi,

Please point me where I am doing mistake or missing something.

I created a simple example to understand the bit and bytes of py++


cpp header file afile.h
=========================
class box{
        public:
                box(int , int );
                int area(box &obj);

        private:
                int length;
                int width;
        };
=========================

cpp source file afile.cpp
=========================
#include"afile.h"
#include<iostream>

box::box(int x, int y):length(x),width(y)
{
}

int box::area(box &obj){
        return obj.length * obj.width;
}

using namespace std;

int main()
{
        box p(10, 20);
        int a;
        a=p.area(p);

        std::cout<<"Area is "<<a<<"\n";
        return 0;
}
======================

py++ code afile.py
========================
import os
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies

mb=module_builder.module_builder_t([r"/home/vbayskar/exPy/afile.cpp"])


mb.free_function('area').call_policies = call_policies.default_call_policies()

mb.build_code_creator( module_name = 'testModule')

mb.write_module('./testModule')
==========================

and when I run this python file afile.py

it gives the following error
============================
/usr/lib/python2.4/site-packages/pygccxml/parser/scanner.py:337: UserWarning: unable to find out array size from expression ""
  warnings.warn( msg )
Traceback (most recent call last):
  File "afile.py", line 8, in ?
    mb.free_function('area').call_policies = call_policies.default_call_policies()
  File "/usr/lib/python2.4/site-packages/pyplusplus/module_builder/builder.py", line 669, in free_function
    , recursive=recursive )
  File "/usr/lib/python2.4/site-packages/pygccxml/declarations/namespace.py", line 96, in free_function
    , recursive=recursive )
  File "/usr/lib/python2.4/site-packages/pygccxml/declarations/scopedef.py", line 354, in _find_single
    found = matcher_module.matcher.get_single( matcher, decls, False )
  File "/usr/lib/python2.4/site-packages/pygccxml/declarations/matcher.py", line 79, in get_single
    raise matcher.declaration_not_found_t( decl_matcher )
pygccxml.declarations.matcher.declaration_not_found_t: Unable to find declaration.  matcher: [(decl type==free_function_t) and (name==area)]
===========================


Thanks
Vishal





DISCLAIMER: 
----------------------------------------------------------------------------------------------------------------------- 
The contents of this e-mail and any attachment(s) are confidential and
intended 
for the named recipient(s) only.  
It shall not attach any liability on the originator or NECHCL or its 
affiliates. Any views or opinions presented in  
this email are solely those of the author and may not necessarily reflect the 
opinions of NECHCL or its affiliates.  
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of  
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have  
received this email in error please delete it and notify the sender 
immediately. . 
-----------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20100323/03bda631/attachment.html>


More information about the gccxml mailing list