473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What's wrong with that


class CSyncClient
{
public:
CSyncClient(void);
virtual ~CSyncClient(void);
//DECLARE_PROPERTY(Login, char*);

friend class Login_;

template<class TYPE>
struct Login_ : public BaseProperty<TYPE>
{
virtual void putprop(TYPE p_Value)
{
CSyncClient::m_pSyncClientSession->SetLogin(p_Value);
}
};
struct Login_<char*Login;
protected:
CSyncClientSession* m_pSyncClientSession;
};


I get :

left of '->SetLogin' must point to class/struct/union/generic type
1 c:\htc\ui\replication\SyncClient.h(109) : while compiling
class template member function 'void
CSyncClient::Login_<TYPE>::putprop(TYPE)'
1 with
1 [
1 TYPE=char *
1 ]
1 c:\htc\ui\replication\SyncClient.h(114) : see reference to
class template instantiation 'CSyncClient::Login_<TYPE>' being compiled
1 with
1 [
1 TYPE=char *
1 ]
Feb 16 '07 #1
4 4841
On 16 Feb, 10:08, mosfet <richo...@free.frwrote:
class CSyncClient
{
public:
CSyncClient(void);
virtual ~CSyncClient(void);

//DECLARE_PROPERTY(Login, char*);

friend class Login_;

template<class TYPE>
struct Login_ : public BaseProperty<TYPE>
{
virtual void putprop(TYPE p_Value)
{
CSyncClient::m_pSyncClientSession->SetLogin(p_Value);
What are you trying to do in the line above? m_pSyncClientSession is
not a static member of CSyncClient. Every CSyncClient has its own
m_pSyncClientSession member. If you want to use the
m_pSyncClientSession member, you need a CSyncClient object because
inside a CSyncClient object is the only place an m_pSyncClientSession
member exists.
}
};
struct Login_<char*Login;

protected:
CSyncClientSession* m_pSyncClientSession;

};
It's not clear what you are trying to do, but at a wild guess it looks
like maybe the put_prop function should be in the CSyncClient class.

template <typename TYPE>
virtual void put_prop(TYPE p_Value)
{
m_pSyncClientSession->SetLogin(p_Value);
}

Gavin Deane

Feb 16 '07 #2
Gavin Deane a écrit :
On 16 Feb, 10:08, mosfet <richo...@free.frwrote:
>class CSyncClient
{
public:
CSyncClient(void);
virtual ~CSyncClient(void);

//DECLARE_PROPERTY(Login, char*);

friend class Login_;

template<class TYPE>
struct Login_ : public BaseProperty<TYPE>
{
virtual void putprop(TYPE p_Value)
{
CSyncClient::m_pSyncClientSession->SetLogin(p_Value);

What are you trying to do in the line above? m_pSyncClientSession is
not a static member of CSyncClient. Every CSyncClient has its own
m_pSyncClientSession member. If you want to use the
m_pSyncClientSession member, you need a CSyncClient object because
inside a CSyncClient object is the only place an m_pSyncClientSession
member exists.
> }
};
struct Login_<char*Login;

protected:
CSyncClientSession* m_pSyncClientSession;

};

It's not clear what you are trying to do, but at a wild guess it looks
like maybe the put_prop function should be in the CSyncClient class.

template <typename TYPE>
virtual void put_prop(TYPE p_Value)
{
m_pSyncClientSession->SetLogin(p_Value);
}

Gavin Deane
Dooh! you are right.
Feb 16 '07 #3
Now it works butr I would like to write a macro, I am trying this

#define DECLARE_PROPERTY(NAME, TYPE) \
friend class NAME##_; \
template<class TYPE\
class NAME##_ \
{ \
}; \

but it doesn't work

error C2332: 'class' : missing tag name

Feb 16 '07 #4
On Feb 16, 11:46 am, mosfet <richo...@free.frwrote:
Now it works butr I would like to write a macro, I am trying this

#define DECLARE_PROPERTY(NAME, TYPE) \
friend class NAME##_; \
template<class TYPE\
class NAME##_ \
{ \

}; \

but it doesn't work

error C2332: 'class' : missing tag name
Run it through the pre-processor and look at the code produced and you
might get an idea of what's wrong. For you that means right-clicking
the project, Properties, C/C++, Preprocessor, Generate Preprocessed
File = Yes.

--
Erik Wikström

Feb 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
10
by: G Matthew J | last post by:
interesting "signal vs. noise" blog entry: http://37signals.com/svn/archives2/whats_wrong_with_ajax.php
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
3
by: Andrew | last post by:
Hi, friends, I have a function which send email with attachments as the follows: public int SendEmailWithAttachment(string fromEmailAddress, string toEmailAddress, string subject, string...
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when...
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
2
by: mingke | last post by:
Hi... So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer.... So here's the part of my code I have problem with: for (i=0; i<size2;...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.