• 1
Votes
name
name Punditsdkoslkdosdkoskdo

In c++ what is Identifier not found and undeclared identifier ??

This i the code i have used and for some reason its saying there are undeclared identifiers

#include <string>
#include <iostream>
#include "stdafx.h"
using namespace std;
int main()
{
    bool Firstboot = true;
    EntryPoint();
    cout << "Hello World!" << endl;
    return 0;
}

int MainMenu()
{
    FormatedOut("MainMenu", "Menu1", "Menu1");
}
int Menu1()
{
    FormatedOut("Menu1", "SubMenuOption1", "SubMenuOption1");
}


int EntryPoint() {
    FormatedOut("MainMenu", "Menu1", "Menu1");

    string option;
    cin >> option;
    if (option == "1")
    {
        Menu1();
    }
}

int FormatedOut(string MenuName, string FirstOption, string FirstOptionTarget) {
    cout << "----------------";
    cout << "| " + MenuName;
    cout << "|---------------";
    cout << "|              ";
    cout << "|  " + FirstOption;
    EntryPoint();
}

I have codded this in C++ on Visual Studio 2017

The errors i have been getting for the past half an hour

C3861   'EntryPoint': identifier not found  8
C2065   'cout': undeclared identifier   9
C2065   'endl': undeclared identifier   9
C3861   'FormatedOut': identifier not found 15
C3861   'FormatedOut': identifier not found 19
C3861   'FormatedOut': identifier not found 24    
C2065   'string': undeclared identifier 26
C2065   'option': undeclared identifier 26
C2065   'cin': undeclared identifier    27
C2065   'option': undeclared identifier 27
C2065   'option': undeclared identifier 28
C2065   'string': undeclared identifier 34

Any help that you can give me will be greatly appreciated

c++

In the end it was pretty simple. The scope resolution operator caused the problem.

Here is the updated code.

#include <ifxPkcTest.h>
namespace ScStdTb {

#define CFG_REG 0
#define CMD_REG 0x4
#define CTRL_REG 0x8
#define STAT_REG 0xC

void BasicTB::test()
{
        void testCase();

}

void BasicTB::testCase()              //SOLUTION
{
     unsigned int data = 0x0;
     data=1;
     REG_WRITE(CTRL_REG,&data);

}

}
  • 0
Reply Report