syntax error : missing ';' before '*' compile error using diffpack library with vsc++6.0

Hi!

I am trying to use the c++ library called Diffpack. The library is only compatible with vsc6.0. When trying to compile any of the supplied applications in vsc++6. I get the following errors:
spacetimescale.h(187) : error C2143: syntax error : missing ';' before '*'
spacetimescale.h(187) : error C2501: 'Vec_NUMT' : missing storage-class or type specifiers
spacetimescale.h(187) : error C2501: 'a_parameter' : missing storage-class or type
Here is some code sample from the file

class ScalarScale : public HandleId
//-----------------------------------------------------------------------------
{
  Vec(NUMT)* a_parameter;  // array to be scaled
  NUMT*      n_parameter;  // number variable to be scaled
  Ptv(NUMT)* p_parameter;  // point vector to be scaled
  // only a_parameter, n_parameter _or_ p_parameter can be used
  // two of them must be NULL, the one that is not NULL is the one to be used
  // the settings of a_parameter, n_parameter etc is performed in the
  // attach functions

public:
  String quantity_name;  // name of scalar quantity to be scaled
  NUMT scale_factor;     // scaled_value = factor * (old_value - reference)
  NUMT scale_reference;
  bool is_scaled;     // indicator reflecting calls to scale/unscale

  ScalarScale (const char* quantity_name = NULL);
 ~ScalarScale ();

Another strange thing is that the header files that are in the same directory as the application is includede with <>, not " ". So I have to manually change this.
Some sample code from wawe1.cpp:

#include <ElmMatVec.h>
#include <readOrMakeGrid.h>
#include <SparseDS.h>
#include "Wave0.h"


Wave0:: Wave0 () {}
Wave0::~Wave0 () {}

void Wave0:: adm (MenuSystem& menu)
{
  SimCase::attach (menu); 
  define (menu);  menu.prompt();  scan();
}

void Wave0:: define (MenuSystem& menu, int level)
{
  menu.addItem (level, "time parameters", "TimePrm::scan syntax",
                "dt=0.05, t in [0,0.9]");
  menu.addItem (level, "gridfile",
                "filename or P=Prepro.../geometry/partition",
                "P=PreproBox | d=1 [0,1] | d=1 elm_tp=ElmTensorProd1 "
  "div=[10], grading=[1]");
  menu.addItem (level, "wave velocity", "c", "1.0");
  menu.addItem (level, "sigma",
  "steepness parameter in initial condition", "1000.0");
  SaveSimRes:: defineStatic (menu, level+1);
  FEM:: defineStatic (menu, level+1);
}



Any help is appreciated



Answer this question

syntax error : missing ';' before '*' compile error using diffpack library with vsc++6.0

  • Kdean6869

    You don't tell us which line is 187 so it is difficult to be sure exactly what the problem is but:

     FSOL wrote:
     
    Vec(NUMT)* a_parameter;  // array to be scaled


    unless Vec is a macro this code is not like any C or C++ I have ever seen so your problem may lie here.

  • ny3ranger

    Thank you!!!
    What does it do when it preprocess
    Both main.cpp and wave0.cpp then compiled successfully, however when trying to build the exe file I get the following errror:

    Compiling...
    Wave0.cpp
    main.cpp
    Linking...
    LINK : fatal error LNK1104: cannot open file "kernel32.lib"
    Error executing link.exe.

    Wave0.exe - 1 error(s), 0 warning(s)


  • fatcat1111

    I suggest that you preprocess the file (use the /P switch from the command-line) and take a look at the code then: as it stands the code is not C++ and hence I am not surprised that the compiler is giving an error.

  • Damian

    Thanks for your quick reply! The line you mentioned is 187. I don't actually know if it is a macro. I am really new to c++. However I know that the library works on linux and that it is supposed to work with vsc++6.
  • tarania


    Problem solved!!
    Thank you again! You have been very helpful. I had to manually add libraries in VC6. I also did a very big mistake: not opening the project file, just the cpp and header files. 




  • ArtRI

    This is a very different error to the previous one you reported. This error means you are missing a library, kernel32.lib, from the link step. You need to add kernel32.lib to the list of additional libraries to link against. Unfortunately it is a long, long time since I have used Visual C++ 6.0 so I can't remember exactly how you do it: but in the projects properties for your project there should be a page for linker options and on this page there should be a way to add an additional library.

  • syntax error : missing ';' before '*' compile error using diffpack library with vsc++6.0