Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,463 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,378 people online right now. Registration is fast and FREE... Join Now!




New Errors

2 Pages V  1 2 >  
Reply to this topicStart new topic

New Errors, Making the transition from 6.0 to .NET

Videege
post 14 Jan, 2005 - 05:30 PM
Post #1


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


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:

CODE
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.
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 15 Jan, 2005 - 09:29 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


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).
User is offlineProfile CardPM

Go to the top of the page

Videege
post 15 Jan, 2005 - 10:50 AM
Post #3


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 16 Jan, 2005 - 10:17 AM
Post #4


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Videege
post 16 Jan, 2005 - 10:09 PM
Post #5


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


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?
User is offlineProfile CardPM

Go to the top of the page

Videege
post 19 Jan, 2005 - 08:20 PM
Post #6


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


No clue whatsoever...?
User is offlineProfile CardPM

Go to the top of the page

sykobag
post 20 Jan, 2005 - 05:25 AM
Post #7


D.I.C Head

**
Joined: 18 Jan, 2005
Posts: 70


My Contributions


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:
CODE

::cout << "Hello" << endl;
//the compiler complains here
//change it to this:
std::cout << "Hello" << std::endl;
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 20 Jan, 2005 - 08:17 AM
Post #8


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


By using the standard namespaces
CODE

using namespace std;

you should not need to specify the namespace inline.
User is offlineProfile CardPM

Go to the top of the page

Videege
post 20 Jan, 2005 - 01:51 PM
Post #9


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Videege
post 20 Jan, 2005 - 01:56 PM
Post #10


rêvant.toujours

Group Icon
Joined: 25 Mar, 2003
Posts: 1,404



Dream Kudos: 150
My Contributions


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

CODE

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

User is offlineProfile CardPM

Go to the top of the page

sykobag
post 20 Jan, 2005 - 01:58 PM
Post #11


D.I.C Head

**
Joined: 18 Jan, 2005
Posts: 70


My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

sykobag
post 20 Jan, 2005 - 02:02 PM
Post #12


D.I.C Head

**
Joined: 18 Jan, 2005
Posts: 70


My Contributions


I'm stumped
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Reply to this topicStart new topic
Time is now: 11/22/08 01:25PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month