Я пытаюсь включить КОЛЛАДА ДОМ библиотека в программу, над которой я работаю (PyMOL) как внешняя зависимость с конечной целью — разрешить экспорт трехмерных сцен в формате COLLADA (.dae). Я могу успешно скомпилировать все до того момента, когда я добавлю #include <Collada14Dom/dae.h>
в соответствующий исходный файл; то есть, если я закомментирую эту единственную строку, все будет хорошо. Я работаю на Mac под управлением 10.8.5 с Xcode 5.
Пока я установил COLLADA DOM v2.2 от Sourceforge, построил DOM через make
(из подкаталога ‘dom’) и установил фреймворк в /Library/Frameworks/Collada14Dom.framework через make install
,
Я также скачал Boost v1.55.0 и устанавливается через ./bootstrap
, ./b2
, ./b2 install
как указано Вот.
Проблема возникает, когда я компилирую после добавления следующей строки в мой COLLADA.cpp
файл.
#include <Collada14Dom/dae.h>
После компиляции я получаю серию ошибок «конфликтующих типов»:
$ sudo /sw/bin/python setup.py build install --home=/opt/pymol --install-lib=/opt/pymol/modules --install-scripts=/opt/pymol
Password:
running install
running build
running build_py
running build_ext
building 'pymol._cmd' extension
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_PYMOL_VMD_PLUGINS -D_PYMOL_LIBPNG -D_PYMOL_FREETYPE -D_PYMOL_INLINE -D_PYMOL_OPENGL_SHADERS -DNO_MMLIBS -D_PYMOL_CGO_DRAWARRAYS -D_PYMOL_CGO_DRAWBUFFERS -D_CGO_DRAWARRAYS -D_PYMOL_GL_CALLLISTS -DOPENGL_ES_2 -D_PYMOL_COLLADA -D_PYMOL_NUMPY -Iov/src -Ilayer0 -Ilayer1 -Ilayer2 -Ilayer3 -Ilayer4 -Ilayer5 -Imodules/cealign/src -Imodules/cealign/src/tnt -Ibuild/generated -Icontrib/uiuc/plugins/include -Icontrib/uiuc/plugins/molfile_plugin/src -I/sw/lib/python2.7/site-packages/numpy/core/include -I/usr/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I/sw/include -I/sw/include/freetype2 -I/sw/include/python2.7 -c layer1/COLLADA.cpp -o build/temp.macosx-10.8-x86_64-2.7/layer1/COLLADA.o -ffast-math -funroll-loops -O3 -fcommon
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:67:
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:91:5: error: conflicting types for '__distance'
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:74:5: note: previous definition is here
__distance(_InputIterator __first, _InputIterator __last,
^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:133:5: error: conflicting types for '__advance'
__advance(_BidirectionalIterator& __i, _Distance __n,
^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:123:5: note: previous definition is here
__advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:149:5: error: conflicting types for '__advance'
__advance(_RandomAccessIterator& __i, _Distance __n,
^
/usr/include/c++/4.2.1/bits/stl_iterator_base_funcs.h:123:5: note: previous definition is here
__advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
In file included from /usr/include/c++/4.2.1/bits/stl_iterator.h:69:
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:92:10: error: functions that differ only in their return type cannot be
overloaded
__two& __test_type(...);
^
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:90:9: note: previous declaration is here
__one __test_type(int _Tp::*);
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:282:5: error: conflicting types for 'operator=='
operator==(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:96:5: note: previous definition is here
operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:288:5: error: conflicting types for 'operator<'
operator<(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:102:5: note: previous definition is here
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:294:5: error: conflicting types for 'operator!='
operator!=(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:109:5: note: previous definition is here
operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:300:5: error: conflicting types for 'operator>'
operator>(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:115:5: note: previous definition is here
operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:306:5: error: conflicting types for 'operator<='
operator<=(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:121:5: note: previous definition is here
operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:312:5: error: conflicting types for 'operator>='
operator>=(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:127:5: note: previous definition is here
operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:332:5: error: conflicting types for 'operator=='
operator==(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:96:5: note: previous definition is here
operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:338:5: error: conflicting types for 'operator<'
operator<(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:102:5: note: previous definition is here
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:344:5: error: conflicting types for 'operator!='
operator!=(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:109:5: note: previous definition is here
operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:350:5: error: conflicting types for 'operator>'
operator>(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:115:5: note: previous definition is here
operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:356:5: error: conflicting types for 'operator<='
operator<=(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:121:5: note: previous definition is here
operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:362:5: error: conflicting types for 'operator>='
operator>=(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_pair.h:127:5: note: previous definition is here
operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
In file included from layer1/COLLADA.cpp:35:
In file included from /Library/Frameworks/Collada14Dom.framework/Headers/dae.h:28:
In file included from /usr/local/include/boost/filesystem/convenience.hpp:22:
In file included from /usr/local/include/boost/filesystem/operations.hpp:25:
In file included from /usr/local/include/boost/filesystem/path.hpp:25:
In file included from /usr/local/include/boost/filesystem/path_traits.hpp:23:
In file included from /usr/local/include/boost/system/error_code.hpp:17:
In file included from /usr/local/include/boost/operators.hpp:86:
In file included from /usr/local/include/boost/iterator.hpp:17:
In file included from /usr/include/c++/4.2.1/iterator:68:
/usr/include/c++/4.2.1/bits/stl_iterator.h:368:5: error: conflicting types for 'operator-'
operator-(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.2.1/bits/stl_iterator.h:318:5: note: previous definition is here
operator-(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.2.1/bits/stl_iterator.h:738:5: error: conflicting types for 'operator=='
operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
^
/usr/include/c++/4.2.1/bits/stl_iterator.h:732:5: note: previous definition is here
operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
^
/usr/include/c++/4.2.1/bits/stl_iterator.h:750:5: error: conflicting types for 'operator!='
operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
^
/usr/include/c++/4.2.1/bits/stl_iterator.h:744:5: note: previous definition is here
operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'gcc' failed with exit status 1
Очевидно, что у GCC есть проблемы с заголовками C ++, но я не уверен, как решить эту проблему.
Одним из важных соображений является то, что в базе кода проекта нет другого кода C ++. (Библиотеки COLLADA на основе C не существует, и я действительно не хочу изобретать колесо здесь.) Поэтому вполне вероятно, что есть какая-то конфигурация, которая должна произойти — некоторые настройки в setup.py, возможно. Есть ли способ сказать setup.py
использовать что-то кроме GCC для компиляции?
Для чего это стоит, я могу полностью воспроизвести проблему (после установки COLLADA DOM и Boost) с помощью следующего:
sscce.cpp:
#ifdef __cplusplus
extern "C" {
#endif
#include <Collada14Dom/dae.h>
int main(){
return 0
}
#ifdef __cplusplus
} // END extern "C"#endif
который, если я пытаюсь построить с помощью gcc sscce.cpp
, выдает те же виды ошибок «конфликтующих типов», что и в полной программе. Как ни странно (для меня, во всяком случае), я также получаю те же ошибки, используя g++ sscce.cpp
так что я думаю, что это не может быть проблемой GCC.
Что мне не хватает? Надеюсь, кто-то уже сталкивался с подобными вещами раньше, и вам на самом деле не нужно устанавливать COLLADA DOM и Boost, чтобы иметь возможность предлагать предложения, поскольку обе библиотеки собирают некоторое время. Как всегда, любая помощь будет высоко ценится.
Спасибо!
Функции в этом файле C ++ должны вызываться другим кодом C в
проект, так что у меня сложилось впечатление, что мне нужно заключить C ++
код во внешних блоках «C», чтобы избежать искажения имени. Разве это не
дело?
extern "C"
блоки позволяют встраивать объявления C в код C ++, а вы хотите наоборот; никаких положений для этого не существует.
Других решений пока нет …