Mineserver Community

Mineserver => Support => Topic started by: koka3000 on April 18, 2011, 06:37:33 pm



Title: Add new class Test
Post by: koka3000 on April 18, 2011, 06:37:33 pm
Hello, I can't add new class.

It is in /src/test.h:
Quote
class Test
{
public:
   void info(void);
   int i;
}

It is in /src/test.cpp:
Quote
#include <test.h>
void Test::info(void)
{
   i = 10;
}

Next I add "/src/test.cpp" to CMakeLists.txt

When I compile I have error:
Quote
~/mineserver$ make all
[  1%] Building CXX object CMakeFiles/mineserver.dir/src/test.cpp.o
/home/akahito/mineserver/src/test.h:1: error: new types may not be defined in a return type
/home/akahito/mineserver/src/test.h:1: note: (perhaps a semicolon is missing after the definition of ‘Test’)
/home/akahito/mineserver/src/test.cpp:3: error: two or more data types in declaration of ‘info’
make[2]: *** [CMakeFiles/mineserver.dir/src/test.cpp.o] Error 1
make[1]: *** [CMakeFiles/mineserver.dir/all] Error 2
make: *** [all] Error 2
Can you say, what I do wrong? :P



Title: Re: Add new class Test
Post by: Carve on April 19, 2011, 01:09:08 am
class Test {

}; // you need the ;