what's wrong of my code

D

Daqian Yang

hi all,

here is code:
File Edit Options Buffers Tools C Help
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

namespace xf{
class Xfile{

public:
void compress() throw (runtime_error);
void stats() throw (runtime_error);

private:
Xfile(string = "mydata", int = 10, int = 10); //constructor
typedef char* Xstr;
Xstr* storage_; //an array of array to store the data
int size_; //lines array contains
int length_; //length for each line
};
}
----
the compiler gave me this error for these two lines(
void compress() throw (runtime_error);
void stats() throw (runtime_error);
)

error:
xfile_a2.h:10: error: parse error before `)' token
xfile_a2.h:11: error: parse error before `)' token
 
V

Victor Bazarov

Daqian Yang said:
hi all,

here is code:
File Edit Options Buffers Tools C Help
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's not code. :)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

namespace xf{
class Xfile{

public:
void compress() throw (runtime_error);
void stats() throw (runtime_error);

private:
Xfile(string = "mydata", int = 10, int = 10); //constructor
typedef char* Xstr;
Xstr* storage_; //an array of array to store the data
int size_; //lines array contains
int length_; //length for each line
};
}
----
the compiler gave me this error for these two lines(
void compress() throw (runtime_error);
void stats() throw (runtime_error);
)

error:
xfile_a2.h:10: error: parse error before `)' token
xfile_a2.h:11: error: parse error before `)' token

In order to use "runtime_error" type, you need to include <stdexcept>
header.

Victor
 
R

Roger Leigh

Victor Bazarov said:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's not code. :)

M-x c++-mode would help here ;-)

(Or add "// -*- C++ -*-" to the top line.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top