Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

C#
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
Posted
Comments
Richard MacCutchan 3-Dec-15 9:55am    
This is nothing to do with the library. The errors occur in a header file (property_tree.hpp) and the error messages even tell you where. So take a look at the lines in question and see why they are causing the problem.
Sergey Alexandrovich Kryukov 3-Dec-15 10:05am    
That's right, syntax error (compilation phase) has nothing to do with library (used by linker). But also, please understand: looking at the compilation error dump without seeing the source code is nearly useless.
—SA

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.
 
Share this answer
 
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.
 
Share this answer
 
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.
 
Share this answer
 
Comments
Richard MacCutchan 3-Dec-15 13:29pm    
It's nothing to do with Microsoft not doing their job properly. It's you not setting the prerequisites for the prpoject correctly. It is quite possible (and acceptable) that you cannot use these headers in a CLI project. You should check with the owners of the library.
Well, I see no reason why a native C++ statement would pass just fine in a native build but would flag a syntax error with the /clr switch. After all the code is native in both cases and c++/cli is supposed to accommodate native c++ syntax. So that is a complier issue!

Right now there are a host of errors associated with functions having no return types (really poorly written code) but returning a value. This passed by native VC C++ build without a hiccup but as soon as the /clr switch is on these statements were all flagged as errors by VC.

The errors for this are,
C#
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


So if C++ doesn't support default int and int is assumed then how did this get past the native compiler?

So that isn't a compiler problem????
 
Share this answer
 
Comments
Richard MacCutchan 4-Dec-15 5:23am    
No it is not a compiler problem, it is (still) down to you not understanding the error messages. There is definitely some switch or prerequisite that needs to be set before you can include these headers and compile the sources. And the only way to find out what they are is by talking to the owners of this library.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900