| name | autofix-namespace |
| description | Fixes 'not a member of namespace' errors by adding namespace qualifiers or using declarations. |
Namespace Skill
Fixes C++ namespace-related compilation errors.
Detection Patterns
'X' is not a member of 'std'
'X' is not a member of 'namespace'
'X' was not declared in this scope (when namespace issue)
Strategy
- Identify Symbol: Extract the symbol and expected namespace.
- Add Qualifier: Prefix the symbol with namespace, or add
using.
Instructions
Step 1: Parse Error
From: 'cout' is not a member of 'std'
Symbol: cout, Namespace: std
Step 2: Common Fixes
Add namespace prefix:
cout << "Hello";
std::cout << "Hello";
Add using declaration:
using std::cout;
using namespace std;
Common std:: Symbols
| Symbol | Namespace |
|---|
cout, cin, endl | std:: |
vector, map, set | std:: |
string | std:: |
unique_ptr, shared_ptr | std:: |
chrono::* | std::chrono:: |