New Errors

Making the transition from 6.0 to .NET

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 11591 Views - Last Post: 03 September 2007 - 04:27 PM Rate Topic: -----

#1 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

New Errors

Posted 14 January 2005 - 06:30 PM

I recently purchased VS .NET 2003; I'm pretty impressed with it, but I have to admit I'm not familiar with most of it. I recently imported one of my old 6.0 projects into .NET. All my source files open fine, but when I try to compile I get these errors:

Compiling...
stock.cpp
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(109) : warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(150) : warning C4018: '<=' : signed/unsigned mismatch
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(204) : warning C4018: '<=' : signed/unsigned mismatch
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(211) : warning C4244: '=' : conversion from 'std::vector<_Ty>::size_type' to 'float', possible loss of data
		with
		[
			_Ty=float
		]
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(264) : warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(380) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98) : error C2825: '_Iter::iterator_category': cannot form a qualified name
		c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\vector(598) : see reference to class template instantiation 'std::iterator_traits<_Iter>' being compiled
		with
		[
			_Iter=std::allocator<float>::value_type
		]
		c:\Documents and Settings\Josh\My Documents\Visual Studio Projects\My Projects\Expo Project\Economics AI\stock.cpp(39) : see reference to function template instantiation 'void std::vector<_Ty>::assign<std::allocator<_Ty>::value_type>(_Iter,_Iter)' being compiled
		with
		[
			_Ty=float,
			_Iter=std::allocator<float>::value_type
		]
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98) : error C2039: 'iterator_category' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99) : error C2825: '_Iter::value_type': cannot form a qualified name
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99) : error C2039: 'value_type' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99) : error C2146: syntax error : missing ';' before identifier 'value_type'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100) : error C2825: '_Iter::difference_type': cannot form a qualified name
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100) : error C2039: 'difference_type' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100) : error C2146: syntax error : missing ';' before identifier 'difference_type'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102) : error C2825: '_Iter::pointer': cannot form a qualified name
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102) : error C2039: 'pointer' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102) : error C2146: syntax error : missing ';' before identifier 'pointer'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103) : error C2825: '_Iter::reference': cannot form a qualified name
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103) : error C2039: 'reference' : is not a member of 'operator``global namespace'''
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103) : error C2146: syntax error : missing ';' before identifier 'reference'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\vector(598) : error C2664: 'void std::vector<_Ty>::_Assign<_Iter>(_Iter,_Iter,std::_Int_iterator_tag)' : cannot convert parameter 3 from 'std::iterator_traits<_Iter>::iterator_category' to 'std::_Int_iterator_tag'
		with
		[
			_Ty=float,
			_Iter=std::allocator<float>::value_type
		]
		and
		[
			_Iter=std::allocator<float>::value_type
		]
		No constructor could take the source type, or constructor overload resolution was ambiguous


Economics AI - 16 error(s), 6 warning(s)



------------------
When I try and look at the errors it points me to some source that I've never even seen before, looks like iterator code. Do I need to change certain things in my code when I make the transition from 6? Any help would be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: New Errors

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: New Errors

Posted 15 January 2005 - 10:29 AM

Can you post the source code? A lot of those errors and warnings look mlike they have to do with the method of compilation (by which I mean the project settings).
Was This Post Helpful? 0
  • +
  • -

#3 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 15 January 2005 - 11:50 AM

Problem is, the warnings I can deal with, but the actual errors I generate point to nothing in MY code (which is rather large and I would be unable to post it here), but some xutility header, so I don't even know what is going wrong. I think it might be project settings; all I know is it ran fine in 6.0.
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: New Errors

Posted 16 January 2005 - 11:17 AM

Yeah, project settings can be different between 6.0 and .NET. Unfortunately, without the source code (I know you said it was too big to post), it's kind of hard to tell which settings are causing the problems. About all I can suggest might be to try and mimic the project settings from 6.0.
Was This Post Helpful? 0
  • +
  • -

#5 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 16 January 2005 - 11:09 PM

ok. I've been browsing msdn and found a nice little "upgrading your projects from 6.0 to .NET" section. I fixed some issue with opening ofstream objects with only the std::ios flag, but I still get the wierd xutility errors. Any ideas on other things I should be looking for?
Was This Post Helpful? 0
  • +
  • -

#6 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 19 January 2005 - 09:20 PM

No clue whatsoever...?
Was This Post Helpful? 0
  • +
  • -

#7 sykobag  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 18-January 05

Re: New Errors

Posted 20 January 2005 - 06:25 AM

I have also been updating 6.0 projects to .NET, I think that a lot of iterator stuff was changed in the compiler settings but I'm not sure. Try highlighting your error in the Task menu after building and press F1 for help on each individual matter and make sure you start from the top of the task list, a lot of build errors create more and more errors. Also make sure that you don't have any code that looks like this:
::cout << "Hello" << endl;
//the compiler complains here
//change it to this:
std::cout << "Hello" << std::endl;


Was This Post Helpful? 0
  • +
  • -

#8 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: New Errors

Posted 20 January 2005 - 09:17 AM

By using the standard namespaces
using namespace std;


you should not need to specify the namespace inline.
Was This Post Helpful? 0
  • +
  • -

#9 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 20 January 2005 - 02:51 PM

My project is a windows app; I don't use the std namespace as much as I do in console apps (mostly only for file i/o), and when I need it, I reference it as std::whatever. I don't think that's the problem...but I'll look through it.
Was This Post Helpful? 0
  • +
  • -

#10 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 20 January 2005 - 02:56 PM

this is the code in xutility.h (vc7/includes) that my errors point to:

  // 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;
	};



Was This Post Helpful? 0
  • +
  • -

#11 sykobag  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 18-January 05

Re: New Errors

Posted 20 January 2005 - 02:58 PM

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98) : error C2039: 'iterator_category' : is not a member of 'operator``global namespace'''

This error is the same error that I was getting when I didn't have the std:: stuff but it could belong to a different namespace, either way it needs to have some namespace written there.
Was This Post Helpful? 0
  • +
  • -

#12 sykobag  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 18-January 05

Re: New Errors

Posted 20 January 2005 - 03:02 PM

I'm stumped
Was This Post Helpful? 0
  • +
  • -

#13 Videege  Icon User is offline

  • rÍvant.toujours
  • member icon

Reputation: 6
  • View blog
  • Posts: 1,413
  • Joined: 25-March 03

Re: New Errors

Posted 20 January 2005 - 03:55 PM

I forget; is there any way after you say using namespace std to revert back to using the global namespace? I thought it was something like using namespace;, but I guess not.
Was This Post Helpful? 0
  • +
  • -

#14 AsymptoticCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-July 05

Re: New Errors

Posted 03 July 2005 - 06:38 PM

Has anybody found a solution or workaround to this problem? I have hit this exact problem (I am using the matrix template library headers) too. I call the headers and get 45 errors mostly about xutility in the same block of code mentioned earlier.
Was This Post Helpful? 0
  • +
  • -

#15 raeyin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-June 05

Re: New Errors

Posted 04 July 2005 - 12:04 PM

Hey, I don't know the solution, but I have a suggestion. The obnoxious thing about .NET is that most of the errors you get don't point to the problem. But, if you can figure out where in your code you were when it called xutility, it might put you on the right track.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2