For$
<!-- begin site header -->
<div id=

Author Topic: Add new class Test  (Read 6570 times)

koka3000

  • Newbie
  • *
  • Posts: 12
    • View Profile
Add new class Test
« 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


Carve

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Add new class Test
« Reply #1 on: April 19, 2011, 01:09:08 am »
class Test {

}; // you need the ;