c++ - Getting error in my opcode.cc file -
i working on assembler (sic/xe) , in process of making opcode table. getting error when compile it
g++ opcodetab.cc undefined first referenced symbol in file main /opt/local/bin/../lib/gcc/sparc-sun-solaris2.10/3.4.6/crt1.o ld: fatal: symbol referencing errors. no output written a.out collect2: ld returned 1 exit status
#include <string> #include <map> #include <utility> #include <iostream> #include "opcodetab.h" #include "opcode_error_exception.h" using namespace std; opcodetab::opcodetab() { //populate map opcodes //[mnemonic] = (hex value, format/size) (int = 0; < num_of_opcodes; i++) opcodes[codes[i]] = info(values[i], sizes[i]); } string opcodetab::get_machine_code(string inopcode) { //change each element of string upper case for(unsigned int i=0;i<inopcode.length();i++) { inopcode[i] = toupper(inopcode[i]); } if(inopcode[0] == '+') // check if format 4 inopcode.erase (0,1); //erase character @ first position opcodes_iter = opcodes.find(inopcode); if(opcodes_iter == opcodes.end()){ throw opcode_error_exception("opcode " + inopcode + " not found");} homecoming (opcodes_iter->second.machine_code); } int opcodetab::get_instruction_size(string inopcode) { /* converts string uppercase, checks see if first character '+' * possible extended format checks see if valid opcode if * homecoming 4 else check see if valid 1 2 or 3 format*/ (unsigned int = 0; < inopcode.length(); i++) { inopcode[i] = toupper(inopcode[i]); } if (inopcode[0] == '+') { inopcode.erase(0, 1); opcodes_iter = opcodes.find(inopcode); if (opcodes_iter == opcodes.end()){ throw opcode_error_exception("opcode " + inopcode + " not found");} else if ((opcodes_iter->second.length) != 3){ throw opcode_error_exception("opcode " + inopcode + " not valid format 4 opcode");} else homecoming 4; } else { opcodes_iter = opcodes.find(inopcode); if (opcodes_iter == opcodes.end()){ throw opcode_error_exception("opcode " + inopcode + " not found");} homecoming (opcodes_iter->second.length); } } does have solution? assembler program
c++ assembly
No comments:
Post a Comment