Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Syntax Error: illegal use of this type as an expression

Posted on 2002-05-07
4
Medium Priority
?
1,105 Views
Last Modified: 2008-03-04
Hi, syntax gurus out there,  I'm trying to use multidimensional WCHAR arrays in VC++, but have run into problems.

Code follows:

struct SnapinData {
    LPWSTR* lpwConnect;
public:
   
    SnapinData() : lpwConnect(NULL) {}
     ~SnapinData(){if(lpwConnect)delete [] lpwConnect;}
};



SnapinData* CServer::GetSnapinData()
{
     
     // Copy all the strings to a wchar array structure
     m_SnapInData.lpwConnect = new WCHAR*[m_saConnect.size()];

     for(INT i=0; m_saConnect.end(); i++)
     {
          m_SnapInData.lpwConnect[i] = new WCHAR[MAX_PATH];
          wcscpy(SnapinData.lpwConnect[i], m_saConnect.at(i).data());
     }

     return &m_SnapInData;
}

I get this error when i try to compile the code:



Compiling...
server.cpp
H:\c++\WksnMgmt\server.cpp(171) : error C2275: 'SnapinData' : illegal use of this type as an expression
        h:\c++\wksnmgmt\server.h(15) : see declaration of 'SnapinData'


Can anyone see the reason for the compile error?
0
Comment
Question by:ossentoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
snoegler earned 200 total points
ID: 6993410
wcscpy(SnapinData.lpwConnect[i], m_saConnect.at(i).data());

should be

wcscpy(m_SnapinData.lpwConnect[i], m_saConnect.at(i).data());
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6994738
Topic still alive?
0
 

Author Comment

by:ossentoo
ID: 6995713
very stupid question i asked.  couldn't see error though!  Thanks a lot
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6995882
:)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question