简体   繁体   English

错误:缺少类型说明符

[英]Error: missing type specifier

I'm trying to do my first application on C++ using MVC pattern. 我正在尝试使用MVC模式在C ++上做我的第一个应用程序。 So, I have a view class, ClientTsFrm, and the ClientTS class, the controller. 因此,我有一个视图类ClientTsFrm和一个ClientTS类即控制器。 To notify to the view class, I decided to use the Observer pattern, so ClienTS heritages from Subject.h. 为了通知视图类,我决定使用Observer模式,因此ClienTS来自Subject.h。

ClientTsFrm has a member called ClientTS in order to do a communication, but when I build the project, it shows this error: ClientTsFrm有一个称为ClientTS的成员以便进行通信,但是当我构建项目时,它显示此错误:

Error 10 error C4430: missing type specifier - int assumed. 错误10错误C4430:缺少类型说明符-假定为int。 Note: C++ does not support default-int (src\\lib\\ClientTS.cpp) 注意:C ++不支持default-int(src \\ lib \\ ClientTS.cpp)

Error 9 error C2146: syntax error : missing ';' 错误9错误C2146:语法错误:缺少';' before identifier 'clientts' (src\\lib\\ClientTS.cpp) 标识符'clientts'之前(src \\ lib \\ ClientTS.cpp)

ClientTsFrm.h ClientTsFrm.h

#pragma once

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include <wx/wx.h>
    #include <wx/frame.h>
#else
    #include <wx/wxprec.h>
#endif

#include "../Data/config.h"
#include "../lib/ClientTS.h"
#include "../data/Session.h"
#include "../data/Message.h" 

#include <wx/sizer.h>
#include <wx/wx.h>
#include <wx/timer.h>
#include <wx/stattext.h>
#include <wx/richtext/richtextctrl.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/grid.h>
#include "NationList.h"
#include "LoginWarnings.h" 
#include "../ArchiveLog.h"

#include "../GlobalVariables.h"
#include "../translateController/translateController.h"
#include "../translateController/translateVariable.h"
#include "FrmMailSending.h"
#include "FrmSettingMail.h"
#include "AudioWizard.h"
#include <list>
#include "FrmSaveChat.h"
//#include "../data/observer.h"

#define MENU_ESCI 1800
#define MENU_OPZIONI 1801
#define MENU_SPEECH 1802

class ClientTsFrm : public wxFrame
{
    private:
        DECLARE_EVENT_TABLE();
        double conta;
        void askForSaving();
        void WxButton1Click(wxCommandEvent& event);
        void btnsendClick(wxCommandEvent& event);
        void txtchatClick(wxRichTextEvent& event);
        void txtchatEnter(wxCommandEvent& event);
        void OnTimerTimeout(wxTimerEvent& event);
        void WxTimer1Timer(wxTimerEvent& event);
        void txtmsgEnter(wxCommandEvent& event);
        void RefreshChat();
        void btnspeechClick(wxCommandEvent& event);
        void ClientTsFrmActivate(wxActivateEvent& event);
        void WxButton2Click(wxCommandEvent& event);
        void WxTimer2Timer(wxTimerEvent& event);
        void gridchatCellLeftClick(wxGridEvent& event);
        void Debug(wxCommandEvent& event);
        void Wizard(wxCommandEvent& event);
        void WxBitmapButton1Click(wxCommandEvent& event);
        void Mail(wxCommandEvent& event);
        void SettingMail(wxCommandEvent& event);
        void Save(wxCommandEvent& event);
        void OnClose(wxCloseEvent& event);

        void notifyMsg(MessagePTR msg);

    public:

        ClientTsFrm(LoginWarnings *warn, wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("TeamTranslate"),
                    const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 
                    long style = wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER);

        virtual ~ClientTsFrm();

        //void ClientTsFrm::notify(ClientTsFrm fn);

    private:
        Session* session;
        ConfigPTR config;
        NationList *nations;
        int REFRESHTIMER = 0;
        uint64 _sclogID;
        wxTimer *WxTimer2;
        wxTimer *WxTimer1;
        wxButton *btnspeech;
        wxRichTextCtrl *txtclient;
        wxTextCtrl *txtlingua;
        wxStaticText *lbllingua;
        wxStaticText *lblnick;
        wxTextCtrl *txtnick;
        wxRichTextCtrl *txtchat;
        wxButton *btnsend;
        wxTextCtrl *txtmsg;
        wxGrid *gridchat;
        wxGrid *gridclient;
        wxBoxSizer *sizer;
        wxGridSizer *gridsizer;
        wxMenuBar *WxMenuBar1;
        wxMenu *ID_MNU_FILE_1001_Mnu_Obj;
        wxMenu *ID_MNU_OPZIONI_1004_Mnu_Obj;
        wxBitmapButton *WxBitmapButton1;
        ClientTS clientts;
};

ClientTS.h ClientTS.h

#pragma once

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/frame.h>
#else
#include <wx/wxprec.h>
#endif

#include "../gui/ClientTsFrm.h"
#include "../data/Session.h"
#include "../data/Message.h"
#include "../data/Config.h" 

#include <wx/sizer.h>
#include <wx/wx.h>
#include <wx/timer.h>
#include <wx/stattext.h>
#include <wx/richtext/richtextctrl.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/grid.h>
#include "../gui\NationList.h"
#include "../gui\NationInfo.h" 
#include "../ArchiveLog.h"

#include "../GlobalVariables.h"
#include "../translateController/translateController.h"
#include "../translateController/translateVariable.h"

#include <list>
#include <functional>
#include "Subject.h"

#include "EventType.h"


#define MENU_ESCI 1800
#define MENU_OPZIONI 1801
#define MENU_SPEECH 1802

class ClientTS : public Subject<EventTS>{
    static Session* session;
    static  ConfigPTR config;
    static bool flagSave;
    static char LANG_MSG_SRC[500];
    static char MSG_SRC[500];

public:
    ClientTS(){
        session = Session::Instance();
        config = session->getConfig();
    }
    ~ClientTS(){}

    static char* getLANG_MSG_SRC(){ return LANG_MSG_SRC; }

    static char* getMSG_SRC(){ return MSG_SRC; }

    static bool getFlagSave(){ return flagSave; }

    static void setFlagSave(bool flg){ flagSave = flg; }

    static void speak(char *LANG, char*MSG);
    static void Print(char*word);
    static size_t read_callback(static void *ptr, size_t size, size_t nmemb, static void *userp);
    static void writeWaveFile(const char* filename, SAudioStreamFormat format, static void* data);
    static void SetupColor();
    static void onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber);
    static void onNewChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID);
    static void onNewChannelCreatedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier);
    static void onDelChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier);
    static void onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage);
    static void onClientMoveSubscriptionEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility);
    static void onClientMoveTimeoutEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* timeoutMessage);
    static void onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper, anyID clientID);
    static void onIgnoredWhisperEvent(uint64 serverConnectionHandlerID, anyID clientID);
    static void onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, const char* extraMessage);
    static void onUserLoggingMessageEvent(const char* logMessage, int logLevel, const char* logChannel, uint64 logID, const char* logTime, const char* completeLogString);
    static void onCustomPacketEncryptEvent(char** dataToSend, unsigned int* sizeOfData);
    static void onCustomPacketDecryptEvent(char** dataReceived, unsigned int* dataReceivedSize);
    static void onEditMixedPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask);
    static void showChannels(uint64 serverConnectionHandlerID);
    static void showChannelClients(uint64 serverConnectionHandlerID, uint64 channelID);
    static void onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message);
    static void showClients(uint64 serverConnectionHandlerID);
    static void createChannel(uint64 serverConnectionHandlerID, const char *name);
    static void deleteChannel(uint64 serverConnectionHandlerID);
    static void renameChannel(uint64 serverConnectionHandlerID);
    static void switchChannel(uint64 serverConnectionHandlerID);
    static void toggleVAD(uint64 serverConnectionHandlerID);
    static void setVadLevel(uint64 serverConnectionHandlerID);
    static void requestWhisperList(uint64 serverConnectionHandlerID);
    static void requestClearWhisperList(uint64 serverConnectionHandlerID);
    static void toggleRecordSound(uint64 serverConnectionHandlerID);
    static int readIdentity(char* identity);
    static int writeIdentity(const char* identity);
    static uint64  enterChannelID();
    static void createDefaultChannelName(char *name);
    static void enterName(char *name);
};

Hope someone could help me. 希望有人可以帮助我。 If you need more code, just let me know please. 如果您需要更多代码,请让我知道。

Thank you for your time. 感谢您的时间。

Edit. 编辑。 The error is on this line (ClientTsFrm.h): 错误在此行上(ClientTsFrm.h):

  ClientTS clientts;

The two headers each try to include the other, which is impossible. 两个标头都试图包含另一个标头,这是不可能的。 One will be included first, and won't have access to the declarations in the other. 一个将首先包含在内,而另一个将无法访问声明。

As far as I can see, ClientTS.h doesn't need anything from ClientTsFrm.h , so just remove that inclusion. 据我ClientTS.hClientTS.h不需要ClientTsFrm.h任何ClientTsFrm.h ,因此只需删除该包含的内容即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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