Why am I getting "Unrecognized attribute 'Result" from gnat 4.4? - attributes

I am getting compiler error, "Unrecognized attribute 'Result" from gnat 4.4.0 in my codes which contain the following:
pragma Postcondition ( Kind ( Create_Object'Result ) = String_Type ) ;
I have checked the GNAT Reference Manual (https://gcc.gnu.org/onlinedocs/gnat_rm/Pragma-Postcondition.html#Pragma-Postcondition). It says pragma Postcondition was implemented prior to Ada 2012 and was retained for compatibility purposes.
I am wondering why the error and how to get rid of it.
Can anyone provide some pointers?
Thanks.

You have to upgrade to an Ada 2012 compiler to have the 'Result attribute available.

Related

Compiling fmt with Intel C on Windows 32

We are compiling fmt with the Intel C compiler on Windows 32bit and 64 bit. On 32 bit we get a strange error. Maybe we are doing something wrong but the issue is what? Here is the error message:
../master/extern/fmt/8.0.1/include/fmt/format-inl.h(1126): error: expression must have a constant value
static constexpr const uint128_wrapper pow10_significands[] = {
^
Any suggestions for a fix? We could potentially build with MSVC.
Update: format-inl.h (=inline format) is only supposed to be used in a header only mode as far I understand and that is not what I want and has not turned on. So I have to figure why this happens.
PS: fmt is great.
The expression in question is constant so this looks like a bug in the compiler or possibly incomplete implementation of constexpr. The error message is misleading but you might be able to workaround the issue by removing constexpr or some other way.
Have you tried building with a C++17 compiler? constexpr isn’t a C keyword afaik.

Visual Studio 2012: Why does a type conflict with its own DLL?

I am suddenly getting scores of warnings like this:
"The type 'SimShop.SimShopCoilTable' in 'c:\SimShop\SimShopUI\SimShopCoilTable.cs' conflicts with the imported type 'SimShop.SimShopCoilTable' in 'c:\SimShop\SimShopUI\bin\Debug\SimShopUI.dll'. Using the type defined in 'c:\SimShop\SimShopUI\SimShopCoilTable.cs'.
The warnings are all telling me that a type I'm using conflicts with the definition of the type in the DLL that is about to be created! Why is this happening?
I've been having a hellish time today with the choice between building for Any CPU and for 64-bit processors. Might it have something to do with that?
Thank you very much.

"error C2228: left of '.ToString' must have class/struct/union"

So I recently got Visual Studio 2012. I converted a Visual Studio 2010 solution to a Visual Studio 2012 project. It was working before I converted it.
I have this line of code:
this->Text = global::ProjectName + " (" + global::Type.ToString() + ") - Path Creator 2.0";
where global::Type is:
ref class global {
public:
static Rct3PathType Type;
...
};
...and Rct3PathType is:
enum class Rct3PathType {
Basic = 0x02060206,
Extended = 0x05060506,
Queue = 0x01070107
};
I get an error at compile time where ever I have called global::Type.ToString() saying "error C2228: left of '.ToString' must have class/struct/union". Considering this all compiled completely well BEFORE switching to Visual Studio 2012, I'm not sure what the issue is! :(
Also, when I try to run the last successful build (which was built with Visual Studio 2010), I get runtime error at startup saying "The program can't start becayse MSVCR100D.dll is missing from your computer." I know this probably doesn't relate to the issue at hand, but does anyone know why this may be happening as well?
Thanks for your help,
Alex
"error C2228: left of '.ToString' must have class/struct/union": enum class is also the syntax for a C++11 enum. To make it a C++/CLI enum, give it an accessibility specifier, which is not allowed on a C++11 enum. In other words, private enum class or public enum class will change it from a C++11 enum to a C++/CLI enum. This wasn't a problem in VS2010 because it doesn't support C++11 enums.
"The program can't start because MSVCR100D.dll is missing from your computer.": VS2012 uses a different C runtime than VS2010. MSVCR100D is the Microsoft Visual C Runtime version 10.0, Debug version. This DLL is installed with VS2010, there is no other way to get it. If you have an old Release build, you can get the runtime redistributable from Microsoft (x86 or x64), and install that to make it run. (That will be MSVCR100.dll, no "D" at the end.)

Using 'auto' in for each causes C3539 - Why?

I am writing a managed DLL in VC2010 (i.e. /CLR is enabled for a VC++ DLL project). Following code wouldn't compile:
System::Collections::Generic::List<int>^ my_list;
for each(auto elem in my_list)
{
}
It raises error C3539: 'auto': a template-argument cannot be a type that contains 'auto'.
I don't understand the reason. I tried compiling the same in VS2012, and it raises same error (which is not appropriate error).
Why compiler fails to deduce the type for a colleciton? The same type of code would work in C# with var keyword.
First, the most importand point from the comments:
presented code does compile in VS2013 c++/cli dll .net 4.5 (Zee, 2014-05-03)
When you compile C++/CLI, which is the .NET binding for C++, you are using a different feature set of the Microsoft compiler. Whether something works either
when /clr is in effect
or, additionally, when you're using a "managed" construct (as in your code)
has nothing to to with if the "normal", native, MSVC compiler accepts it.
So as for "why": It would simply appear that auto type deduction did not work for the managed handle types in VS2010 and VS2012, but, according to Zee's comment, has then been implemented in VS2013. (A quick Search Engine check didn't find any official statement wrt. this, so I may be wrong.)

Cannot Compile OpenCV 2.4.5 with VS 2013 RTM

Has anyone had any luck compiling openCV with VS 2013 RTM? I have tried and get a bunch of "min doesn't belong to namespace std" "max doesn't belong to namespace std" in the IlmImf module, and opencv_features2d doesn't compile with the following error:
opencv\modules\core\include\opencv2/core/core.hpp(4512): fatal error C1075: end of file found before the left brace '{' at '......\modules\features2d\src\features2d_init.cpp(187)' was matched
Since the latest CMake UI doesn't yet support building with 2013 (at least from the UI and I'm a noob), my process was configuring CMake for 2012, and then opening the generated solution with 2013 and upgrading the compiler to vc12.
I was able to get past the min/max errors by adding header includes for in the 'offending' files, but I am stumped by the full error I posted above.
Thanks
Update:
The accepted answer provides what is necessary to compile OpenCV in 32-bit debug and release, and 64-bit debug, but now the compiler fails to compile 64-bit release due to an internal compiler error. This is likely the compiler's fault at this point, but the answer is still solves many problems.
Update 2:
So the 64-bit issue turned out to be a bug in the auto-vectorizer. Here is the corresponding workaround.
Hi, thanks for the great bug report. I confirm this is a bug in the compiler optimizer. We will fix it in a future release.
If you need a source code workaround, please turn the vectorizer off on the loop inside computeOrbDescriptor:
#pragma loop(no_vector)
for (int i = 0; i < dsize; ++i)
{
**...**
That lets me build orb.cpp & stardetector.cpp.
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
I am closing this MSConnect item. Feel free to respond if you need anything else.
Thanks,
Eric Brumer - Microsoft Visual C++ Team
The connect bug can be found here. Unfortunately the real fix for this is postponed until a later date.
I've managed to compile OpenCV 2.4.6 on VS2013 RC, but initially it had the same errors as in question.
I've opened VS solution and fixed all error in two steps:
1) Replaced (Ctrl+H)
#include \<string\>
to
#include <algorithm>\n#include <string>
in entire solution (be sure to enable RegExp in replace dialog)
2) In "modules/opencv_features2d/Src/features2d_init.cpp" changed line 184 to:
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&) obj.detector);
(search for "GridAdaptedFeatureDetector" in this file for other OpenCV versions)
For the first issue:
http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
It is explicitly called out:
You must #include <algorithm> when calling std::min() or std::max().
Before due to the internal implementation of the VC++ libraries <string> would pull in these functions.
Please see http://code.opencv.org/issues/3273 for more information on the internal compiler error issue.

Resources