Solved

error in xutility when compiling

Posted on 2012-04-08
9
1,184 Views
Last Modified: 2012-04-09
I'm moving my project from VS 6.0 to VS2008.  I can't build one DLL because of a series of errors that I don't understand.

This compiles without issue in Visual Studio 6.0, but gives this big mess in VS2008.   Can someone explain?  Thanks...

Errors are like:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(764) : error C2039: 'iterator_category' : is not a member of 'vec'
1>        c:\alphard\new_++\metron port\met3d9\Ops3D.h(11) : see declaration of 'vec'
1>        .\WarpDialog.cpp(429) : see reference to class template instantiation 'std::iterator_traits<_Iter>' being compiled

and it points into this code in xutility (which is a part of Vis Studio 9.0 include files):

            // TEMPLATE CLASS iterator_traits
template<class _Iter>
      struct iterator_traits
      {      // get traits from iterator _Iter
      typedef typename _Iter::iterator_category iterator_category;
      typedef typename _Iter::value_type value_type;
      typedef typename _Iter::difference_type difference_type;
      typedef difference_type distance_type;      // retained
      typedef typename _Iter::pointer pointer;
      typedef typename _Iter::reference reference;
      };

Part of my problem is that I've never used Temmplates and don't understand what is going on here.
0
Comment
Question by:tullhead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 37823873
What is the code at c:\alphard\new_++\metron port\met3d9\Ops3D.h(11) and the other file?
0
 

Author Comment

by:tullhead
ID: 37824193
Attached is Ops3d.h which is referred to (for definition of "vec") and the code that uses "vec" that the error pointed to in WarpDialog.cpp is here below:


//
// Compare "p" to the cloud of points in "pKeys" and return the distance to the nearest one.
//
double mindistance(vec p, KeyPointArray* pKeys)
{
   int i,n;
   double dist, minsofar;
   minsofar = 1000000000.0;
   n=pKeys->GetSize();
   for (i=0;i<n; i++)
   {
      vec vv = pKeys->GetAt(i).v;
      dist = distance(p,vv);
        if (dist < minsofar)
        {
         minsofar = dist;
        }
   }
   return minsofar;
}
Ops3D.h
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 37824242
The problem seems to be the line

      dist = distance(p,vv);

Open in new window


where the compiler seems to mistakenly match your 'distance()' to 'std::distance()' (http://www.sgi.com/tech/stl/distance.html)

Use

      dist = ::distance(p,vv); // do indicate this is NOT 'std::distance()'

Open in new window


instead to indicate the correct scope.

BTW, does your '_WIN32_WINNT' problem stil persist or have you just forgotten about that Q?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tullhead
ID: 37824520
Yes, thats it!  Thanks.  I will accept this as the solution as soon as EE lets me.  Something wonky -- have to log out and re-log-in before it lets me 'accept as solution' ??

On the _WIN32_WINNT problem -- haven't jumped on that yet - but will here soon...
0
 
LVL 86

Expert Comment

by:jkr
ID: 37824614
>>have to log out and re-log-in before it lets me 'accept as solution' ??

Shouldn't be the case, but will let CS know...
0
 
LVL 86

Expert Comment

by:jkr
ID: 37824917
That's whyt I got as a reply: "Without knowing specifics (browser, OS, etc) I couldn't begin to guess." - so, if you are wiing to provide that, we can move on a bit ;o)
0
 

Author Comment

by:tullhead
ID: 37825092
I'm not being specific, because I haven't figured out the pattern yet - but here is all I know at the moment:  I was on IE9 on a win7-64 PC and found I couldn't click on the "accept as answer" icon.  Logged out of EE and back in, but still couldn't.  Then went to XP SP3 machine running IE8 and logged in, and was able to click the icon and assign points.
0
 
LVL 86

Expert Comment

by:jkr
ID: 37825142
Thank you!
0
 
LVL 86

Expert Comment

by:jkr
ID: 37825329
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question