Search code examples
c++linuxcompilation

sourcecode compilation in linux


I am not able to compile the source code for Verilog2C++ in centos 6.4 linux. http://verilog2cpp.sourceforge.net/

I get the following errors when i run the make command

verilog.l:435: error: 'assert' was not declared in this scope

When i comment out all the assert statements. I run into these errors which I CANNOT FIX

Verilog.cc: In constructor 'moe::Verilog::Number::Number(const char*)':
Verilog.cc:224: error: invalid conversion from 'const char*' to 'char*'
Verilog.cc:230: error: invalid conversion from 'const char*' to 'char*'
Verilog.cc:245: error: invalid conversion from 'const char*' to 'char*'

Below is the code snippet from Verilog.cc file

  Verilog::Number::Number(const char* text):
    text_(text)
  {
    static const char* BIN_NUM ="01XZ";
    static const char* OCT_NUM ="01234567XZ";
    static const char* HEX_NUM ="0123456789ABCDEFXZ";
    
    vector<char> bits;
    const char* ptr;

    ...

    char* idx;
    ptr =text+strlen(text)-1;
    for( ;*ptr!='\'';ptr-- )
      {
        switch( base )
          {
          case 2:
            idx =index(BIN_NUM,toupper(*ptr)); //THIS LINE CAUSES ERROR
            if( idx!=NULL )
              if( bits.size()<width )
                bits.push_back( *idx );

I am not able to fix this because of lack of C/C++ knowledge

Can you please help me compile and run the program successfully.


Solution

  • Problem solved by compiling the code on an older machine with older version of gcc and then taking the executable to the new machine. It works just fine.

    Thanks to Claudio's hint.