C ++ Visual Studio 2013:解决命名空间错误 [英] C++ Visual Studio 2013: Solving Namespace Errors

查看:87
本文介绍了C ++ Visual Studio 2013:解决命名空间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


好的,所以我试着编译我的程序并给它一个最终的测试,看看它的一切是否正常。我似乎已经通过链接类或其他任何问题解决了所有错误,现在我的最后一个问题是修复一些我一直得到的明显的命名空间错误。
我有6个错误和1个警告,它们都属于下面这一段代码。

OK, so Im trying to compile my program and give it a final test to see if everything with it is working. I seem to have resolved all my errors with linking classes or whatever, and now my last problem is fixing some apparently namespace errors that I keep getting. I have 6 errors and 1 warning, and they all pertain to this one block of code below.


代码:

#include "Class1.h"
#ifndef CLASS2_H
#define CLASS2_H
#endif
using namespace std;

Class1::Class1()
{
}

int main()
{
    Class2 A;
    int choice;
    bool gameOn = true;
    while (gameOn != false){
        cout << "1 - Play Game" << endl;
        cout << "2 - Quit Game" << endl;

        cin >> choice;

        switch (choice)
        {
            //Opening section of the game to introduce the player to the game
        case 1: {
                    cout << "Your adventure starts now!\n";
                    system("PAUSE");
                    cout << "Welcome to ATAG brave adventurer!\n";
                    system("PAUSE");
                    A.standby();
        } break;

            //Code to end the game if the player chooses the #2 option
        case 2:
            cout << ".jpeg!\n";
            system("PAUSE");
            exit(0);
        }
    }
    return 0;
}

Class1::~Class1()
{
}



以下是我一直收到的错误:

And here are the errors I keep receiving:

Error   1   error C2653: 'Class1' : is not a class or namespace name    e:\c++ - copy - copy - copy\atag2_ - copy\atag2_\class1.cpp 8   1   ATAG2_
Error   2   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   e:\c++ - copy - copy - copy\atag2_ - copy\atag2_\class1.cpp 9   1   ATAG2_
Warning 3   warning C4508: 'Class1' : function should return a value; 'void' return type assumed    e:\c++ - copy - copy - copy\atag2_ - copy\atag2_\class1.cpp 10  1   ATAG2_
Error   4   error C2653: 'Class1' : is not a class or namespace name    e:\c++ - copy - copy - copy\atag2_ - copy\atag2_\class1.cpp 44  1   ATAG2_
Error   5   error C1903: unable to recover from previous error(s); stopping compilation e:\c++ - copy - copy - copy\atag2_ - copy\atag2_\class1.cpp 44  1   ATAG2_
6   IntelliSense: name followed by '::' must be a class or namespace name   e:\C++ - Copy - Copy - Copy\ATAG2_ - Copy\ATAG2_\Class1.cpp 7   1   ATAG2_
7   IntelliSense: name followed by '::' must be a class or namespace name   e:\C++ - Copy - Copy - Copy\ATAG2_ - Copy\ATAG2_\Class1.cpp 43  1   ATAG2_



如果我可以解决这些问题,那应该可以解决我的所有程序错误,让我完成这个。有没有人得到任何什么方面的解决方案可以帮助我解决这些错误?我真的很感激,因为这似乎是我需要解决的最后一个问题。谢谢。

If I can get these out of the way, that should solve all my program errors and let me finish with this. Has anyone got any solutions whatsoever to help me fix these errors? I'd really appreciate it, because this seems to be last problem I need to solve. Thanks.


顺便说一下,如果有人有解决方案,请为我简化,因为我仍然非常不熟悉编码和技术术语我很容易与这一切混淆。为每个人欢呼。

By the way, if anyone does have a solution, please simplify it for me, as Im still very much unfamiliar with coding and technical jargon and I get incredibly easily confused with all this. Cheers everyone.

推荐答案

此论坛正在讨论Visual Studio WPF / SL Designer,Visual Studio Guidance Automation Toolkit,开发人员文档和帮助系统以及Visual Studio编辑器。

This forum is discussing Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor. 

您的问题与C ++开发有关,我将此线程移至

Your issue is related to C++ develop, I will move this thread to

Visual Studio语言
Windows
桌面开发
> Visual
C ++
获得专业答案。

Visual Studio Languages ,Windows Desktop Development >Visual C++ for a professional answer.

最好的问候,

Best regards,

Joyce


这篇关于C ++ Visual Studio 2013:解决命名空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆