Hello, I'm trying to compile my client, For a video game. But I get this error

c:\drsource stuff\46022362clientlatest\clientlatest\filemgr.h(18) : error C2275: 'std::iterator' : illegal use of this type as an expression
{
  typedef map<int, T*>           hash;
  typedef map<int, int>          check;
  typedef map<int, T*>::iterator index;

And here is another one

c:\program files\microsoft visual studio 8\vc\include\xutility(486) : see declaration of 'std::iterator'
struct iterator
			: public _Iterator_base

	{	// base type for all iterator classes
	typedef _Category iterator_category;
	typedef _Ty value_type;
	typedef _Diff difference_type;
	typedef _Diff distance_type;	// retained
	typedef _Pointer pointer;
	typedef _Reference reference;
	};

template<class _Category,
	class _Ty,
	class _Diff = ptrdiff_t,
	class _Pointer = _Ty *,
	class _Reference = _Ty&,
	class _Base_class = _Iterator_base>
		struct _Iterator_with_base
			: public _Base_class
c:\drsource stuff\46022362clientlatest\clientlatest\filemgr.h(158) : see reference to class template instantiation 'TFileMgr<T,N>' being compiled
private:
  T*           m_pBuffer;
  check        m_mpCheck;
  hash         m_mpBank;
  int          m_nError;
  CHSEL_STREAM m_hsel;
};
c:\drsource stuff\46022362clientlatest\clientlatest\profiler.h(55) : warning C4244: 'return' : conversion from 'LONGLONG' to 'DWORD', possible loss of data
DWORD	GetCurrent(){ return m_n64CounterEnd.QuadPart-m_n64CounterStart.QuadPart; };

Without code blocks that start from line 1, it's hard to tell which line of your code has generated the error. That said, I'll take a stab at it.

Error #1. I'm not at all sure what it's complaining about.

Error #2. If you're specifying:

#include <someSTLheader>
using namespace std;

then iterator refers to std::iterator which is probably already included into your scope, and you're now trying to override it. There are a number of possible solutions, including (in no particular order)
limiting what you're "using" (rather than everything in the std:: namespace), not including a "using" statement at all (and prefixing std:: wherever needed), and/or using a fairly common idiom of using CamelCase for your own types and classes (or simply Capitalize them in the case of a single word -- "Iterator" is less likely to be defined within STL than "iterator").

Error #3. Try declaring your template as:

TFileMgr<T*,N>

but again, a bit more code might be helpful, especially the class constructor.

Error #4. The "QuadPart" member of the variable is presumably a LONGLONG type, therefore, the difference between two is also a LONGLONG. If you're sure the difference won't be that large, then explicitly cast the result to your return type, e.g.:

return (DWORD)(m_n64CounterEnd.QuadPart - m_n64CounterStart.QuadPart);

I'm sure others will contribute additional ideas!

It still didn't fix it for me, I'm about to give up, The source code isn't mine, It belongs to an old friend of mine, Here is the source http://www.mediafire.com/?65hp8c37fg47avd Maybe you can take a look at it and figure out what's wrong

Here is my output error log, If that helps with anything.

1>------ Build started: Project: dragon, Configuration: Debug Win32 ------
1>Build started 10/25/2011 2:37:28 PM.
1>InitializeBuildStatus:
1>  Touching ".\Debug\dragon.unsuccessfulbuild".
1>ClCompile:
1>  StdAfx.cpp
1>c:\users\kids only- including\desktop\client104\filemgr.h(14): error C2143: syntax error : missing ';' before '<'
1>c:\users\kids only- including\desktop\client104\filemgr.h(14): error C2059: syntax error : '<'
1>c:\users\kids only- including\desktop\client104\filemgr.h(15): error C2143: syntax error : missing ';' before '{'
1>c:\users\kids only- including\desktop\client104\filemgr.h(15): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\kids only- including\desktop\client104\filemgr.h(207): error C2039: 'Load' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\filemgr.h(254): error C2039: 'Load' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\filemgr.h(271): error C2039: 'LoadFromClass' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\filemgr.h(308): error C2039: 'Save' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\filemgr.h(318): error C2039: 'Encode' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\filemgr.h(324): error C2039: 'Decode' : is not a member of 'TFileMgr<T,N>'
1>c:\users\kids only- including\desktop\client104\profiler.h(55): warning C4244: 'return' : conversion from 'LONGLONG' to 'DWORD', possible loss of data
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.82
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Always good to address the first error first. Since I don't see anything obvious wrong at line 14 of filemgr.h, try removing the international character-set comment above it, and see if that fixes the one problem.

The rest of the errors are very likely a result of the problems around lines 14-15.

We've already discussed the warning from profiler.h, you can get rid of it easily enough, but it's also probably safe to ignore unless you expect those counter variables to get -very- far apart.

If so, there may be a way to tell Visual Studio what language(s) to accept in source-code files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.