SparseLib and c++

From: Joe C (cj5815_at_yahoo.com)
Date: 11/27/04


Date: 27 Nov 2004 13:50:09 -0800

Can someone tell me how to use SparseLib with the cygwin c++ complier?

I installed the libaries using the make file as instructed by the readme files.
I include the references to the header files (see program below)

When I try to try to compile the programs it does not work?

Am I referencing the library correctly?

Does anyone have an sample code I code look at?

Below is program I am using and the error I am getting.

Thanks.

Joe

#include <iostream>
#include <stdlib.h>

#include "compcol_double.h"
#include "comprow_double.h"
#include "coord_double.h"
#include "iohb_double.h"

using namespace std;

int main()

double tot = 1.e-6;
int result, maxit = 160;

        double val[12] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0,
                          7.0, 8.0, 9.0, 10.0, 11.0, 12.0};
        int colind[12] = {0, 1, 4, 0, 1, 2, 1, 2, 4, 3, 0, 4};
        int rowptr[6] = { 0, 3, 6, 9,10, 12};
        double rowsum[5] = {6.0, 15.0, 24.0, 10.0, 23.0};
        double colsum[5] = {16.0, 14.0, 14.0, 10.0, 24.0};

        CompRow_Mat_double R(5,5,12,val,rowptr,colind);

return 0;

}

> $ g++ testSparse.cpp -o testSparse.exe
testSparse.cpp:4:28: compcol_double.h: No such file or directory
testSparse.cpp:5:28: comprow_double.h: No such file or directory
testSparse.cpp:6:26: coord_double.h: No such file or directory
testSparse.cpp:7:25: iohb_double.h: No such file or directory
testSparse.cpp: In function `int main()':
testSparse.cpp:14: error: parse error before `double'
testSparse.cpp:26: error: 'CompRow_Mat_double' is used as a type, but is not
   defined as a type.
testSparse.cpp:40: error: parse error before `return'



Relevant Pages

  • porting problem
    ... Socket.h:47: parse error before `)' ... Socket.h:46: conflicts with previous declaration `int Socket::sending' ... Socket.cpp:33: ANSI C++ forbids declaration `memset' with no type ... Socket.cpp:38: ANSI C++ forbids declaration `exit' with no type ...
    (comp.unix.programmer)
  • Suggestions for refactoring unusual tables
    ... id (int, primary key) ... systext (string) ... catalog_id ... type_id (int, references catalog_entry) ...
    (comp.databases)
  • viewml cross compilation problem
    ... fltk/qstring.h:21: parse error before `int' ... fltk/qstring.h:22: parse error before `const' ... fltk/qstring.h:23: redefinition of `int m_bNull' ... fltk/qstring.h:26: non-member function `copy' cannot have `const' ...
    (comp.os.linux.embedded)
  • Re: Learning C - Scanf or Getch, or Getchar not working correctly after first loop.
    ... int busDays; ... junk.c:12: parse error before '/' token ... junk.c:12: warning: no semicolon at end of struct or union ... junk.c:58: ISO C forbids data definition with no type or storage ...
    (comp.lang.c)
  • Cygwin vector problem
    ... I cannot compile a simple code as below using cygwin. ... is_equal.cpp:11: error: parse error before `>' token ... is_equal.cpp: In function `int main': ... is_equal.cpp:25: error: `cout' undeclared ...
    (comp.lang.cpp)