带有c ++ / cli的原生.lib文件 [英] native .lib file with c++/cli
问题描述
您好,
我有一个使用本机.lib库的本机C ++项目,该库在VS 2012中作为本机C ++应用程序构建得很好。我想使用点网的东西,所以我打开/ clr开关并重建。然后我得到了下面列出的一系列构建错误。我知道除了我(或软件供应商)以外的任何人都需要趟过这一点。面向Linux的软件供应商在此/ cli构建过程中没有提供任何帮助或支持。所有错误仅在与.lib库关联的几个头文件中引用行。我无法访问库源文件,所以我无法重建它或弄乱它。
我想知道是否有人可以建议任何广泛的笔画我可能会考虑让这个工作。
以下是构建错误
Hello,
I have this native C++ project using a native .lib library that builds just fine in VS 2012 as a native C++ application. I want to use dot net stuff so I turn on the /clr switch and rebuild. I then get a host of build errors listed below. I know this is a lot to expect anyone other than me (or the software vendor) to wade through. The software vendor being Linux oriented provides no help or support in this /cli build endeavor. All the errors reference lines in just a few header files associated with the .lib library. I have no access to the library source file so I can't rebuild it or mess with it.
I'm wondering if anyone can suggest any broad strokes that I might consider to get this to work.
Here are the build errors
Error 1 error C2611: 'property' : illegal following '~' (expected identifier) C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 2 error C2988: unrecognizable template declaration/definition C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 3 error C2059: syntax error : 'property' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 4 error C2143: syntax error : missing ';' before '/' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 6 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 7 error C2143: syntax error : missing ';' before '/' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 8 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 9 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 10 error C2039: 'create' : is not a member of 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 12 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 13 error C2039: 'access' : is not a member of 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 15 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 16 error C2990: 'uhd::property_tree' : non-class template has already been declared as a class template C:\Program Files (x86)\UHD\include\uhd\device.hpp 32
Error 17 error C2955: 'uhd::property_tree' : use of class template requires template argument list C:\Program Files (x86)\UHD\include\uhd\device.hpp 109
Error 18 error C2027: use of undefined type 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\device.hpp 109
Error 19 error C2955: 'uhd::property_tree' : use of class template requires template argument list C:\Program Files (x86)\UHD\include\uhd\device.hpp 117
Error 20 error C2027: use of undefined type 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\device.hpp 117
Error 21 error C1189: #error : <atomic> is not supported when compiling with /clr or /clr:pure. C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\atomic 9
Error 22 error C2611: 'property' : illegal following '~' (expected identifier) C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 23 error C2988: unrecognizable template declaration/definition C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 24 error C2059: syntax error : 'property' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 103
Error 25 error C2143: syntax error : missing ';' before '/' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 26 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 27 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 122
Error 28 error C2143: syntax error : missing ';' before '/' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 29 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 30 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.hpp 123
Error 31 error C2039: 'create' : is not a member of 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 32 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 33 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 88
Error 34 error C2039: 'access' : is not a member of 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 35 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 36 error C2143: syntax error : missing ',' before '&' C:\Program Files (x86)\UHD\include\uhd\property_tree.ipp 93
Error 37 error C2990: 'uhd::property_tree' : non-class template has already been declared as a class template C:\Program Files (x86)\UHD\include\uhd\device.hpp 32
Error 38 error C2955: 'uhd::property_tree' : use of class template requires template argument list C:\Program Files (x86)\UHD\include\uhd\device.hpp 109
Error 39 error C2027: use of undefined type 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\device.hpp 109
Error 40 error C2955: 'uhd::property_tree' : use of class template requires template argument list C:\Program Files (x86)\UHD\include\uhd\device.hpp 117
Error 41 error C2027: use of undefined type 'uhd::property_tree' C:\Program Files (x86)\UHD\include\uhd\device.hpp 117
Error 42 error C1189: #error : <atomic> is not supported when compiling with /clr or /clr:pure. C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\atomic 9
推荐答案
感谢您的回复。
是的,我同意你所说的一切。它们看起来像头文件中的语法错误。我想听别人说,因为我不明白为什么本机代码中的C ++ / CLI语法错误不是本机C ++语法错误?我不打算附加头文件,因为我可以解决语法错误。我只是想确保我没有错过项目设置更基本的东西。
Thanks for your response.
Yes, I agree with everything you said. They look like syntax errors in the header files. I wanted to hear someone else say that since I'm not understanding why a C++/CLI syntax error in native code not be a native C++ syntax error? I'm not going to attach the header files because I can work through syntax errors. I just wanted to make sure that I'm not missing something more basic with the project setup.
这是一个编译器问题,这意味着编译(!!!)这些文件的先决条件不满足。你需要包含一些(系统)其他标题和宏/设置来解决这个问题。
我会去另一个(我相信更容易)的方式:写一些包装clr dll,它可以从外部访问C ++。优点:你只需要一些全局变量和一些转换程序就完成了。
It is a compiler problem which means that the prerequisites for compiling (!!!) these files arent met. You need to include some (system) other headers and macros/settings to resolve that.
I would go an other (and I believe easier) way:. write some wrapping clr dll which is externally accessable for C++. The advantage: you only need some globals and some conversion routine and your done.
好的。然后你说这是一个编译器问题,如果微软正确地完成了他们的工作,那么这些错误就不会发生。毕竟,可以使用/ clr开关更改可接受的本机C ++语法。
我没看到包装器dll会如何简单。这是一个很大的图书馆。
谢谢。
Ok. Then you are saying that this is a compiler issue and if Microsoft had done their job properly then these errors would not be happening. After all, acceptable native C++ syntax should not change with the /clr switch.
I'm not seeing how a wrapper dll would be easy. It is a big library.
Thanks.
这篇关于带有c ++ / cli的原生.lib文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!