Fork me on GitHub
  May 28, 2018, 07:08:53 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Add new class Test  (Read 1666 times)
koka3000
Newbie
*
Posts: 12


View Profile
« 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? Tongue

Logged
Carve
Newbie
*
Posts: 4


View Profile
« Reply #1 on: April 19, 2011, 01:09:08 am »

class Test {

}; // you need the ;
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!