简体   繁体   中英

Source SDK Compile Errors

I am making a Counter Strike mod and during compiling I am getting some errors:

Panel.cpp(715): error C2248: 'CInput::CVerifiedUserCmd' : cannot access private class declared in class 'CInput'
1>          \SDK\\game\\client\\input.h(238) : see declaration of 'CInput::CVerifiedUserCmd'
1>          \SDK\\game\\client\\input.h(39) : see declaration of 'CInput'

Line 715:

CInput::CVerifiedUserCmd* ver = NULL;

Declaration:

class CVerifiedUserCmd
{
public:
    CUserCmd    m_cmd;
    CRC32_t     m_crc;
};

How do I fix this?

You're probably trying to use a private inner class:

class A
{
   class B
   {
   };
};

Simply make the class public if you wish to use it outside:

class A
{
public:
   class B
   {
   };
};

EDIT:

If the class is private and it's part of a 3rd party lib, you're probably doing it wrong. Look for a different solution to your problem, it was made private for a reason.

Assuming that was your code put class

CVerifiedUserCmd

to public section of the outer class. Otherwise you cannot use CVerifiedUserCmd since it is private inner class.

You probably can't (unless you want to edit the engine itself) - look for a better solution to your problem. Basically, don't try to manually instantiate CInput::CVerifiedUserCmd .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM