# Python boost unresolved overloaded function type

**URL:** <https://discuss.avogadro.cc/t/python-boost-unresolved-overloaded-function-type/2143>\
**Category:** Development\
**Created:** [February 27, 2012, 7:23pm UTC](https://discuss.avogadro.cc/t/python-boost-unresolved-overloaded-function-type/2143 "2012-02-27T19:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Kedziora](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Gary\_Kedziora](https://discuss.avogadro.cc/u/Gary_Kedziora)\
**Post date:** [February 27, 2012, 7:23pm UTC](https://discuss.avogadro.cc/t/python-boost-unresolved-overloaded-function-type/2143/1 "2012-02-27T19:23:22Z")

</div>

I have having trouble compiling ~/libavogadro/src/python/fragment.cpp.  
The issue appears to be that the python boost template function  
arguments can not be resolved when there is a constant and non  
constant version. Here is the make output for an example:

[82%] Building CXX object  
libavogadro/src/python/CMakeFiles/python-module.dir/fragment.cpp.o  
cd /app/ccm/opt/build/avogadro/libavogadro/src/python &&  
/usr/bin/g++44 -Dpython\_module\_EXPORTS -D\_BSD\_SOURCE  
-DHAVE\_GCC\_VISIBILITY -DENABLE\_PYTHON -DQT\_OPENGL\_LIB -DQT\_GUI\_LIB  
-DQT\_CORE\_LIB -DQT\_NO\_DEBUG -fvisibility=hidden  
-fvisibility-inlines-hidden -fpermissive -O2 -g -Wnon-virtual-dtor  
-Wno-long-long -ansi -Wcast-align -Wchar-subscripts -Wall -Wextra  
-Wpointer-arith -Wformat-security -fno-check-new -fno-common -pedantic  
-fPIC -I/app/ccm/opt/build/avogadro/libavogadro/include  
-I/app/CSE/20111228/Release/qt-4.7.4/include  
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtOpenGL  
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtGui  
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtCore  
-I/app/ccm/opt/build/avogadro/libavogadro/src  
-I/u/home/app/ccm/opt/include/eigen2  
-I/u/home/app/ccm/opt/include/openbabel-2.0  
-I/u/home/app/CSE/20111228/Apps/boost-1.46.0/include  
-I/app/CSE/20111228/Release/python-2.6.4/include/python2.6  
-I/app/ccm/opt/src/avogadro/libavogadro/include  
-I/app/ccm/opt/build/avogadro/libavogadro/src/python  
-I/app/CSE/20111228/Analysis/numpy-1.3.0/lib/python2.6/site-packages/numpy/core/include  
-o CMakeFiles/python-module.dir/fragment.cpp.o -c  
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp  
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp: In  
function ‘void export\_Fragment()’:  
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp:21:  
error: no matching function for call to  
’boost::python::class\_\<Avogadro::Fragment,  
boost::python::bases\<Avogadro::Primitive, mpl\_::void\_, mpl\_::void\_,  
mpl\_::void\_, mpl\_::void\_, mpl\_::void\_, mpl\_::void\_, mpl\_::void\_,  
mpl\_::void\_, mpl\_::void\_\>, boost::noncopyable\_::noncopyable,  
boost::python::detail::not\_specified\>::add\_property(const char [5],  
, void  
(Avogadro::Fragment::\*)(QString), const char [26])'  
make[2]: \*\*\* [libavogadro/src/python/CMakeFiles/python-module.dir/fragment.cpp.o]  
Error 1  
make[2]: Leaving directory `/u/home/app/ccm/opt/build/avogadro' make[1]: *** [libavogadro/src/python/CMakeFiles/python-module.dir/all] Error 2 make[1]: Leaving directory`/u/home/app/ccm/opt/build/avogadro’  
make: \*\*\* [all] Error 2

This has to do with initializing the name property of the Fragment  
class for Python. In ~/libavogadro/src/fragment.h, we have

```
  inline QString name() { return m_name; }
  inline const QString & name() const { return m_name; }

```

It seems that in situations where there are not const member functions  
(or other const qualifies), this works ok. I have run across this  
type of problem with C++ the distant past, but don’t remember much  
about it. Anyway, what solution would be acceptable for the Avogadro  
developers?

Thanks,  
Gary

---

<div class="post-metadata">

**Author:** ![mhanwell](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/mhanwell/32/16_2.png) [@mhanwell](https://discuss.avogadro.cc/u/mhanwell)\
**Post date:** [February 27, 2012, 7:29pm UTC](https://discuss.avogadro.cc/t/python-boost-unresolved-overloaded-function-type/2143/2 "2012-02-27T19:29:09Z")

</div>

On Mon, Feb 27, 2012 at 2:23 PM, Gary Kedziora [gkedziora@gmail.com](mailto:gkedziora@gmail.com) wrote:

> I have having trouble compiling ~/libavogadro/src/python/fragment.cpp.  
> The issue appears to be that the python boost template function  
> arguments can not be resolved when there is a constant and non  
> constant version. Here is the make output for an example:

\> \> This has to do with initializing the name property of the Fragment \> class for Python. In ~/libavogadro/src/fragment.h, we have \> \> inline QString name() { return m\_name; } \> inline const QString & name() const { return m\_name; } \> \> It seems that in situations where there are not const member functions \> (or other const qualifies), this works ok. I have run across this \> type of problem with C++ the distant past, but don't remember much \> about it. Anyway, what solution would be acceptable for the Avogadro \> developers? \> You don't mention what version you are building, this should be fixed in master as far as I am aware. If doing a git pull does not fix the issue can you let me know what commit you are on (git show from the source directory).

Thanks,

Marcus

---

<div class="post-metadata">

**Author:** ![Gary\_Kedziora](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/g/85e7bf/32.png) [@Gary\_Kedziora](https://discuss.avogadro.cc/u/Gary_Kedziora)\
**Post date:** [February 28, 2012, 12:32am UTC](https://discuss.avogadro.cc/t/python-boost-unresolved-overloaded-function-type/2143/3 "2012-02-28T00:32:22Z")

</div>

> You don’t mention what version you are building, this should be fixed  
> in master as far as I am aware. If doing a git pull does not fix the  
> issue can you let me know what commit you are on (git show from the  
> source directory).

I have a version from Geoff’s git with features that have not been reviewed yet.
