前提・実現したいこと
私はC++を触り始めて日が浅く馬鹿げた質問をしているかもしれませんが,どうか教えていただけると幸いです.
Windows10にてVisual Studio 2019を使用しています.コンパイルはコマンドプロンプトで行いました.
githubにてC++で書かれたソースコードをダウンロードし,CMakeでビルドしようした際に出たエラーが解消できません.
ソースコードのURLは以下です.
https://github.com/GuillaumeVDu/MTUSpline#readme
このソースコードはBoost, XSD V4, CMAKEの3つが必須であるとのことでインストールし,実際にCMakeを使いConfigureとGenerateするところまではたどり着いたのですが,その後「cmake --build .」でビルドを実行するとエラーが出てしまい,これがどうしても解消できません.
発生している問題・エラーメッセージ
エラーは全部で4つです.
(1)E:\Program Files (x86)\CodeSynthesis XSD 4.0\include\xsd/cxx/tree/serialization.txx(104,22): error C2872: 'DOMDocument'
: あいまいなシンボルです。 [E:\Opensim Files\MTUSpline-master\build\MTUSpline\MTUSpline.vcxproj]
(2)E:\Program Files (x86)\CodeSynthesis XSD 4.0\include\xsd/cxx/tree/serialization.txx(104,52): error C2440: '初期化中': 'xerc
esc_3_1::DOMDocument' から 'DOMDocument &' に変換できません。 [E:\Opensim Files\MTUSpline-master\build\MTUSpline\MTUSpline.vcxproj
]
(3)E:\Program Files (x86)\CodeSynthesis XSD 4.0\include\xsd/cxx/tree/serialization.txx(110,41): error C2027: 認識できない型 'DOMD
ocument' が使われています。 [E:\Opensim Files\MTUSpline-master\build\MTUSpline\MTUSpline.vcxproj]
(4)E:\Program Files (x86)\CodeSynthesis XSD 4.0\include\xsd/cxx/tree/serialization.txx(115,31): error C2027: 認識できない型 'DOMD
ocument' が使われています。 [E:\Opensim Files\MTUSpline-master\build\MTUSpline\MTUSpline.vcxproj]
該当のソースコード
C++
1// file : xsd/cxx/tree/serialization.txx 2// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC 3// license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 5#include <string> 6#include <sstream> 7 8#include <xercesc/dom/DOMAttr.hpp> 9#include <xercesc/dom/DOMElement.hpp> 10 11#include <xsd/cxx/xml/string.hxx> // xml::{string, transcode} 12#include <xsd/cxx/xml/dom/serialization-header.hxx> // dom::{prefix, clear} 13 14#include <xsd/cxx/tree/elements.hxx> 15#include <xsd/cxx/tree/types.hxx> 16#include <xsd/cxx/tree/list.hxx> 17 18// The only way to make the following serialization operators 19// for fundamental types work is to defined them in the xercesc 20// namespace so that they can be found by ADL. Placing them into 21// the global namespace does not work. 22 23(中略) 24 25namespace xsd 26{ 27 namespace cxx 28 { 29 namespace tree 30 { 31 // List serialization operators for std::basic_string and C string. 32 // 33 34 template <typename C> 35 void 36 operator<< (list_stream<C>& ls, const C* s) 37 { 38 ls.os_ << s; 39 } 40 41 template <typename C> 42 void 43 operator<< (list_stream<C>& ls, const std::basic_string<C>& s) 44 { 45 ls.os_ << s; 46 } 47 48 // Insertion operators for type. 49 // 50 inline void 51 operator<< (xercesc::DOMElement& e, const type& x) 52 { 53 xml::dom::clear<char> (e); 54 55 if (!x.null_content () && x.dom_content ().present ()) 56 { 57 // Clone the contents of the element. 58 // 59 using namespace xercesc; 60 61 DOMDocument& doc (*e.getOwnerDocument ()); 62 const DOMElement& se (x.dom_content ().get ()); 63 DOMNamedNodeMap& sa (*se.getAttributes ()); 64 65 for (XMLSize_t i (0), n (sa.getLength ()); i != n; ++i) 66 e.setAttributeNode ( 67 static_cast<DOMAttr*> (doc.importNode (sa.item (i), true))); 68 69 for (DOMNode* sn (se.getFirstChild ()); 70 sn != 0; 71 sn = sn->getNextSibling ()) 72 e.appendChild (doc.importNode (sn, true)); 73 } 74 } 75(略) 76
試したこと
正直何もできませんでした.似たような内容の質問を参考に空欄を::で区切ってみたりしましたが,効果がありませんでした.
ConfigureとGenerate時はBuilding for: Visual Studio 16 2019と表示されるのに対して,ビルド時は.NET Framework 向け Microsoft (R) Build Engine バージョン 16.9.0+5e4b48a27 Copyright (C) Microsoft Corporation.All rights reserved.
と変わるのが気になっていますが何か関係あるでしょうか.
おそらくとても勉強不足で,まだここで質問をするレベルにも達していないことは重々承知しているのですが,どうかヒントだけでも教えていただけないでしょうか.
補足情報
CMAKE 3.20.2
XSD 4.0
Visual Studio 2019
回答1件
あなたの回答
tips
プレビュー