Click here to Skip to main content
16,005,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Notifications and messages in win app. Pin
sawerr18-Nov-06 19:25
sawerr18-Nov-06 19:25 
AnswerRe: Notifications and messages in win app. Pin
Michael Dunn18-Nov-06 20:36
sitebuilderMichael Dunn18-Nov-06 20:36 
GeneralRe: Notifications and messages in win app. Pin
sawerr18-Nov-06 21:38
sawerr18-Nov-06 21:38 
GeneralRe: Notifications and messages in win app. Pin
Michael Dunn18-Nov-06 22:20
sitebuilderMichael Dunn18-Nov-06 22:20 
AnswerRe: Notifications and messages in win app. Pin
dinpura19-Nov-06 18:59
dinpura19-Nov-06 18:59 
QuestionFinding rectangle coordinates Pin
Oliver12318-Nov-06 9:18
Oliver12318-Nov-06 9:18 
AnswerRe: Finding rectangle coordinates Pin
PJ Arends18-Nov-06 9:23
professionalPJ Arends18-Nov-06 9:23 
QuestionVC6.0 to VC7 - templates, c++ standards conformance proble Pin
cobra99918-Nov-06 7:50
cobra99918-Nov-06 7:50 
Hi guys,

I’m hoping that someone might be able to help with a problem I have porting some libraries from VC6.0 to compile in VC7/Visual Studio .NET 2003.

The Author of the libraries is unable to help, and it seems that the problem is with c++ standards conformance (related to mostly templates.)

I’ve stripped down part of the code to one of the lib’s, and made a small simple example ( Win32 console test app ) below to show the problem, and the error(s) the VC7 compiler gives when trying to compile it. I’ve never been that good getting my head round and using templates, so this is turning into a major headache for me to fix.

If anyone can help, i would really appreciate it.

Thanks. Smile | :)

#include "stdafx.h"
#include <iostream>
using namespace std;


namespace lang
{
template <class T> class NumberReader
{
public:
NumberReader();
int put( char ch );
const T& value() const;
bool valid() const;
};

template <> class NumberReader<double>
{
public:
NumberReader()
{m_state=STATE_INIT; m_valid=false;}
int put( char ch );
T value() const;
bool valid() const{return m_valid;}

private:

enum State
{
STATE_INIT,
STATE_SIGN,
STATE_BODY,
STATE_FRACTION,
STATE_EXP,
STATE_EXP_BODY,
STATE_EXP_FRACTION,
};

bool m_valid;
State m_state;
};
}

int _tmain(int argc, _TCHAR* argv[])
{

return 0;
}



error C2146: syntax error : missing ';' before identifier 'value'

error C2501: 'lang::NumberReader<double>::T' : missing storage-class or type specifiers

warning C4183: 'value': missing return type; assumed to be a member function returning 'int'
AnswerRe: VC6.0 to VC7 - templates, c++ standards conformance proble [modified] Pin
Waldermort18-Nov-06 7:59
Waldermort18-Nov-06 7:59 
AnswerRe: VC6.0 to VC7 - templates, c++ standards conformance proble Pin
markkuk18-Nov-06 8:02
markkuk18-Nov-06 8:02 
AnswerRe: VC6.0 to VC7 - templates, c++ standards conformance proble Pin
PJ Arends18-Nov-06 8:08
professionalPJ Arends18-Nov-06 8:08 
GeneralRe: VC6.0 to VC7 - templates, c++ standards conformance proble Pin
cobra99918-Nov-06 12:51
cobra99918-Nov-06 12:51 
Questiondynamic array sizes Pin
Waldermort18-Nov-06 6:02
Waldermort18-Nov-06 6:02 
AnswerRe: dynamic array sizes Pin
PJ Arends18-Nov-06 6:33
professionalPJ Arends18-Nov-06 6:33 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 6:50
Waldermort18-Nov-06 6:50 
GeneralRe: dynamic array sizes Pin
Mark Salsbery18-Nov-06 6:55
Mark Salsbery18-Nov-06 6:55 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:17
Waldermort18-Nov-06 7:17 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:08
professionalPJ Arends18-Nov-06 7:08 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:14
Waldermort18-Nov-06 7:14 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:22
professionalPJ Arends18-Nov-06 7:22 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:33
Waldermort18-Nov-06 7:33 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:38
professionalPJ Arends18-Nov-06 7:38 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:46
Waldermort18-Nov-06 7:46 
AnswerRe: dynamic array sizes Pin
Michael Dunn18-Nov-06 14:00
sitebuilderMichael Dunn18-Nov-06 14:00 
AnswerRe: dynamic array sizes Pin
Christian Graus18-Nov-06 14:15
protectorChristian Graus18-Nov-06 14:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.