This is a very amateur question with what I'm sure is going to be a very simple answer, but I cannot seem to figure out the problem. I have a header file with a corresponding .cpp file, but for some reason whenever I try to compile with g++, I keep getting the error:
declaration does not declare anything
I'm pretty sure the problem is that I'm not initializing the (only) variable in the file, but I'm not sure what to initialize it to. If anyone can help, I would greatly appreciate it! Here are my files:
SymbolTableDictionary.h
#ifndef SymbolTable
#define SymbolTable
#include <new>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
#pragma once
struct Symbol
{
std::string Name;
int Address;
Symbol::Symbol()
{ }
Symbol::Symbol(const string name, int address)
{
std::string sym(name);
this->Name = sym;
this->Address = address;
}
};
extern map<std::string, Symbol> SymbolTable;
#endif
SymbolTableDictionary.cpp
#include <new>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <map>
#include "SymbolTableDictionary.h"
using namespace std;
map<std::string, Symbol> SymbolTable;
Compilation errors:
In file included from SymbolTableDictionary.cpp:8:0:
SymbolTableDictionary.h:18:5: error: extra qualification ‘Symbol::’ on member ‘Symbol’ [-fpermissive]
SymbolTableDictionary.h:21:5: error: extra qualification ‘Symbol::’ on member ‘Symbol’ [-fpermissive]
SymbolTableDictionary.h:29:8: error: declaration does not declare anything [-fpermissive]
SymbolTableDictionary.cpp:12:1: error: declaration does not declare anything [-fpermissive]