I have two files
1.dfa.hpp and 2. test.cpp
1.dfa.hpp's content
Code:
#include<iostream>
using namespace std;
namespace DFASpace{
class dfa {
dfa(int n) {
cout << "The value of n is: " << n << endl;
}
};
}
2.test.cpp's content
Code:
#include "dfa.hpp"
using DFASpace;
int main(){
dfa d = dfa(50);
return 0;
}
Am getting errors when I compile as:
Code:
[kapil@localhost learn3]$ g++ test.cpp
test.cpp:3: error: expected nested-name-specifier before ‘DFASpace’
test.cpp:3: error: namespace ‘DFASpace’ not allowed in using-declaration
test.cpp: In function ‘int main()’:
test.cpp:6: error: ‘dfa’ was not declared in this scope
test.cpp:6: error: expected ‘;’ before ‘d’