Cuberite Forum
Compiling MCServer with codeblocks - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Compiling MCServer with codeblocks (/thread-1142.html)



Compiling MCServer with codeblocks - wamilou - 05-23-2013

Hi everyone,

I want to modify and compile MCServer with codeblocks but I have many problems with compile Squirrel3 and MCServer.

I imported workspace from Visual C++ (I hate that ide) to codeblocks.

Did someone already do this ? Because I don't find any solution for that...
Thank you in advance.


RE: Compiling MCServer with codeblocks - NiLSPACE - 05-23-2013

Squirrel should be disabled by default. Don't know if that changes if you change ide( i have not allot of experience with compilers )


RE: Compiling MCServer with codeblocks - wamilou - 05-23-2013

What is Squirrel exactly ? Disable => removing from my workspace ?

EDIT : Here is the log when compiling MCServer :
||=== MCServer, Debug Win32 ===|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|113|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|114|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|115|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|115|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|115|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|115|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|116|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|116|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|116|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|116|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|117|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|117|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|117|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|117|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|122|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|123|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|123|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|123|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|123|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|124|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|124|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|124|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|124|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|125|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|125|error: ISO C++ forbids declaration of 'keyname' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|125|error: 'AString' does not name a type|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|125|error: ISO C++ forbids declaration of 'valuename' with no type [-fpermissive]|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp||In member function 'bool cIniFile::ReadFile()':|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|60|error: 'FILE_IO_PREFIX' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp||In member function 'bool cIniFile::WriteFile()':|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|157|error: 'FILE_IO_PREFIX' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp||In member function 'bool cIniFile::SetValueI(const string&, const string&, int, bool)':|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|331|error: 'AString' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|331|error: expected ';' before 'Data'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|332|error: 'Data' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|332|error: 'Printf' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp||In member function 'bool cIniFile::SetValueF(const string&, const string&, double, bool)':|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|342|error: 'AString' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|342|error: expected ';' before 'Data'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|343|error: 'Data' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|343|error: 'Printf' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp||In member function 'bool cIniFile::SetValueV(const string&, const string&, char*, ...)':|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|353|error: 'va_list' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|353|error: expected ';' before 'args'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|355|error: 'args' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|355|error: 'va_start' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|357|error: 'AString' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|357|error: expected ';' before 'Data'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|358|error: 'Data' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|358|error: 'AppendVPrintf' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|359|error: 'va_end' was not declared in this scope|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|367|error: no 'std::string cIniFile::GetValue(unsigned int, unsigned int, const string&) const' member function declared in class 'cIniFile'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|378|error: no 'std::string cIniFile::GetValue(const string&, const string&, const string&) const' member function declared in class 'cIniFile'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.cpp|395|error: prototype for 'int cIniFile::GetValueI(const string&, const string&, int) const' does not match any in class 'cIniFile'|
C:\Users\wamilou\Documents\Github\MCServer\iniFile\iniFile.h|116|error: candidate is: int cIniFile::GetValueI(const int&, const int&, int) const|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 6 seconds) ===|


RE: Compiling MCServer with codeblocks - xoft - 05-23-2013

Squirrel is an alternate scripting language once added to MCS, but it has been removed because it was unstable and noone really maintained it. It's still in the repository, but it isn't compiled anymore.

As for the compile errors, they're most probably caused by not having all the include paths set up correctly. You need to set compiler flags for additional includes to all the major MCServer source directories. Have a look at the GNUmakefile, the variable INCLUDE lists them all.

I haven't seen CodeBlocks for a while, but the last time I checked, VS was still much more usable than CodeBlocks was. The CB debugger was pain in the *** to work with, it was slow and the UI was dumb. The project management system was weird, too.


RE: Compiling MCServer with codeblocks - wamilou - 05-23-2013

But from where AString comes ? External librairy ?
I look the GNUMakesFile : I see just some libraries like pthread but no error about that.

And why I don't use VC : always not working with me ... when opening project with VC => same error


RE: Compiling MCServer with codeblocks - xoft - 05-23-2013

AString is a typedef in source/StringUtils.h, that file is included from source/Globals.h, which is included from every cpp file in the project. It is used for precompiled header generation in MSVC, so it has to be included using the very same line, >>#include "Globals.h"<< in every file, regardless of the path. That's why you need to set up the include paths correctly.

The include paths are in the INCLUDE variable in GNUmakefile:
Code:
INCLUDE = -I.\
        -Isource\
        -Isource/md5\
        -IWebServer\
        -Isource/items\
        -Isource/blocks\
        -Itolua++-1.0.93/src/lib\
        -Ilua-5.1.4/src\
        -Izlib-1.2.7\
        -IiniFile\
        -Itolua++-1.0.93/include\
        -Ijsoncpp-src-0.5.0/include\
        -Ijsoncpp-src-0.5.0/src/lib_json\
        -Iexpat
You need to set your project's include paths to match these (without the "-I", of course)

Maybe if you wrote your VS version and the exact error message, we could try find a fix for that. Not saying that having a C::B support would be nice, but for all of us on Windows, MSVC2008 Express is the primary IDE; and then there are the Linux gyus for whom there's GNUmakefile.


RE: Compiling MCServer with codeblocks - wamilou - 05-25-2013

Sorry, for late answer, but all paths are already in set in compiler and they are corrects !

Something else to try ?


RE: Compiling MCServer with codeblocks - xoft - 05-26-2013

I tried to compile MCS with the latest official C::B installation on Windows; I imported the MSVC solution and then I had to set the paths in the build options; for some reason the paths needed to be relative to the project folder, so I had to prepend a "../" to all of them. Actually I just put "../source" in the search paths for the MCServer project, that is enough.
Now I'm down to 3 compilation errors, those seem so weird that I'm not sure what's going on here - why do all the other compilers (even gcc on linux) not complain about it?
Code:
mc-server\source\Bindings.cpp:6109: error: base `cEntity' with only non-default constructor in class without a constructor
mc-server\source\Bindings.cpp:7280: error: base `cPawn' with only non-default constructor in class without a constructor
mc-server\source\Bindings.cpp:9290: error: base `cPlayer' with only non-default constructor in class without a constructor



RE: Compiling MCServer with codeblocks - NiLSPACE - 05-26-2013

Code:
mc-server\source\Bindings.cpp:6109: error: base `cEntity' with only non-default constructor in class without a constructor
mc-server\source\Bindings.cpp:7280: error: base `cPawn' with only non-default constructor in class without a constructor
mc-server\source\Bindings.cpp:9290: error: base `cPlayer' with only non-default constructor in class without a constructor
Wink you have a \


RE: Compiling MCServer with codeblocks - xoft - 05-26-2013

No, it's just impossible to set up the C::B workspace right. I've eliminated all the compilation errors, but now it won't link.
Code:
mingw32\bin\ld.exe: cannot find -l-lstdc++
It seems like C::B is passing a wrong arg to the linker, it wants to say "-lstdc++", but says "-l-lstdc++" instead.

I have put my initial work on the C::B project in the SVN.