Solved

Syntax Error: illegal use of this type as an expression

Posted on 2002-05-07
4
1,100 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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

707 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