compile error

S

stef

Anyone have any guesses as to why I am getting an error message when I try
to compile:

In file included from CP.h:13,from driver.cpp:5:
cb.h:33: invalid data member initialization
cb.h:33: (use `=' to initialize static data members)
*** Error code 1
make: Fatal error: Command failed for target `driver.o'

line 33 is :
HT<string, s1, s2> db(MAX); // constructor
 
K

Kevin Goodsell

stef said:
Anyone have any guesses as to why I am getting an error message when I try
to compile:

In file included from CP.h:13,from driver.cpp:5:
cb.h:33: invalid data member initialization
cb.h:33: (use `=' to initialize static data members)
*** Error code 1
make: Fatal error: Command failed for target `driver.o'

line 33 is :
HT<string, s1, s2> db(MAX); // constructor

By some amazing coincidence, the crystal balls of every single regular
in this group happen to be broken. Therefore we cannot see your code, or
the problems it contains, unless you post it.

Please follow the guidelines laid out here:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

-Kevin
 
D

David Harmon

On Sat, 10 Apr 2004 06:17:00 GMT in comp.lang.c++, "stef"
Anyone have any guesses as to why I am getting an error message when I try
to compile:

In file included from CP.h:13,from driver.cpp:5:
cb.h:33: invalid data member initialization
cb.h:33: (use `=' to initialize static data members)
*** Error code 1
make: Fatal error: Command failed for target `driver.o'

line 33 is :
HT<string, s1, s2> db(MAX); // constructor

That is most likely an invalid static member initialization!
Instead of initialization there, try using assignment ('=') instead.
Or, you could post more information about what you are trying to do!
 
J

Jeff Schwab

stef said:
Anyone have any guesses as to why I am getting an error message when I try
to compile:

In file included from CP.h:13,from driver.cpp:5:
cb.h:33: invalid data member initialization
cb.h:33: (use `=' to initialize static data members)
*** Error code 1
make: Fatal error: Command failed for target `driver.o'

line 33 is :
HT<string, s1, s2> db(MAX); // constructor

Do you happen to come from a Java background? It looks like you're
trying to initialize a member within the class definition, like this:

struct C {
static int const i( 32 );
};

If the member actually is a static integer constant, replace "i(32)"
with "i = 32". Else, you'll need to define and initialize the member
outside the class definition.
 

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

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top