小编Bor*_*vic的帖子

C++前向声明和"不允许不完整类型"错误

我有两个类(或更好的是,头文件)是我的C++程序的一部分,我根本无法使这一切工作!作为我的应用程序的一部分,他们基本上需要彼此的数据才能正常运行.

不要通过阅读本代码的内容来折磨自己; 我只需要解决前向声明相互包含问题,所以只需看看代码中与此问题相关的那些部分.

错误发生在第二个代码片段,最后(我不得不从第一个片段中删除大量代码,所以我可以发布问题,我想这与我的问题无关).

introForm.h

#pragma once
#include <stdlib.h>
#include "creditsForm.h"
#include "registerForm.h"
#include "aboutForm.h"
#include "QuizForm.h"
#include <windows.h>
#include <time.h>
#ifndef __introForm__H__
#define __introForm__H__

namespace InteractiveQuiz {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    ref class QuizForm;

    /// <summary>
    /// Summary for introForm
    /// </summary>
    public ref class introForm : public System::Windows::Forms::Form
    {
    public:
        introForm(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here …
Run Code Online (Sandbox Code Playgroud)

c++ c++-cli declaration forward incomplete-type

2
推荐指数
1
解决办法
3万
查看次数

标签 统计

c++ ×1

c++-cli ×1

declaration ×1

forward ×1

incomplete-type ×1