Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22040

undefined reference eeror [abi:cxx11] when using map and compiling with clang

$
0
0

I started working on a language parser and came across with undefined reference while I was using std::map<std::string, std::string>

/usr/bin/ld: /home/leksoBor/Desktop/research/neuLogo/src/./rules/0000_program_base/Program.hh:106: undefined reference to `ProgramObj::envCnfgTable[abi:cxx11]'    /usr/bin/ld: /home/leksoBor/Desktop/research/neuLogo/src/./rules/0000_program_base/Program.hh:107: undefined reference to `ProgramObj::envCnfgTable[abi:cxx11]'    /usr/bin/ld: /home/leksoBor/Desktop/research/neuLogo/src/./rules/0000_program_base/Program.hh:108: undefined reference to `ProgramObj::envCnfgTable[abi:cxx11]'    /usr/bin/ld: /home/leksoBor/Desktop/research/neuLogo/src/./rules/0000_program_base/Program.hh:109: undefined reference to `ProgramObj::envCnfgTable[abi:cxx11]'    /usr/bin/ld: parser.tab.o:/home/leksoBor/Desktop/research/neuLogo/src/./rules/0000_program_base/Program.hh:113: more undefined references to `ProgramObj::envCnfgTable[abi:cxx11]' follow

This is the error message I am getting and the code is following:

static void resetEnvCnfgTable()  {    envCnfgTable.insert(std::pair<std::string,std::string>("version", "0.0") );    envCnfgTable.insert(std::pair<std::string,std::string>("description", "no description"));    envCnfgTable.insert(std::pair<std::string,std::string>("real-type", "64-bit"));    envCnfgTable.insert(std::pair<std::string,std::string>("whole-type", "32-bit"));    envCnfgTable.insert(std::pair<std::string,std::string>("random-type", "mersenne"));  };  static void printEnvCnfgTable()  {    for(std::map<std::string, std::string>::iterator it = envCnfgTable.begin(); it != envCnfgTable.end(); it ++)    {      std::cout << it -> first << "   " << it -> second << '\n';    }   };  static std::map<std::string, std::string> envCnfgTable; 

I use:

clang++ -g -c -Wall -std=c++11  -o ../../parts/grammar/Program.o Program.cc

Any suggestions? I saw some threads similiar but could not resolve the problem.


Viewing all articles
Browse latest Browse all 22040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>