|
Compiling minerCPP
|
|
03-09-2010, 04:36 AM
(This post was last modified: 03-09-2010 07:49 AM by PyroPyro.)
Post: #1
|
|||
|
|||
|
Compiling minerCPP
Sometimes it is nice to compile software yourself, just for safety's sake.
I noticed there were a few people that couldn't get minerCPP to compile, so I made this quick (image heavy) tutorial to guide you through. While the project used in the tutorial is specific to minerCPP, the basic process is essentially the same for other software, even those written in different languages. ALL THE IMAGES ARE CUT OFF. TO VIEW THE ENTIRE IMAGE, RIGHT CLICK AND HIT "VIEW IMAGE". I WAS TOO LAZY TO SHRINK THESE. To start, I will be using Microsoft Visual Studio Professional Edition. You can use the Microsoft Visual C++ Express Edition if you like, you just wont have the bells and whistles I do (none of them are actually used here). You will need to first open the program (no shit right?): ![]() Relatively simple stuff so far. Next we need a project file. The project is Visual Studio's way of keeping track of where all your code is placed. It also determines some basic build rules, and the type of program that you will make. ![]() Now we need to determine what kind of project we want. minerCPP in specific is considered a "Console Application" and needs to be created as such. In the project window, select the "Win32" project type, and then the "Win32 Console Application" template. Give it a name, and the default directory is probably fine. ![]() On the next screen, click "Next". ![]() You will notice some basic application settings. Ensure that "Console Application" is selected and check off "Empty Project" as in the picture. Now hit finish. ![]() On the left is a "Solution Explorer". This is a visualization of your project. If you do not have a Solution Explorer, click View -> Solution Explorer. Once your explorer is sorted out, right click any folder (I use source because I want too) and click Add -> Existing Item. ![]() Now locate the folder that the source files that you downloaded are contained. In my picture you see green check marks on them, this is from SVN. You may or may not have these, they are not important for this. Select all your source files (everything in the trunk folder) and click "Add". ![]() Now all the source files will appear in your Solution Explorer. You can double click and view these if you want, but modification should not be needed. ![]() Now we need to compile the project so we can run it. Click Build -> Rebuild Solution. If "Rebuild Solution" is not an option, just use "Build". ![]() Ok so now it is compiling. You will get a load of warnings, all of which can be ignored for now. At the very bottom however, there is an error about zlib. Let's examine this. ZLIB is a compression library. A library contains functions and code that your programs can use, if you tell them too do so. minerCPP uses ZLIB, and so we need to make sure the project knows that. ![]() Go and download the ZLIB binaries. Unzip the file, and READ THE INSTRUCTIONS. I can not stress this enough, read every read-me file that is provided. In the read-me are instructions on how to include ZLIB. Follow the three steps. For simplicity (and because I'm a bit lazy) I will only show the last one. Right click one of the folders, and click Add -> Existing Item and find the zlib.lib that you downloaded and add that file. ![]() You should get a pop-up about a "Custom Build Rule". Click "No", if you didn't get a pop-up, then you are in the clear. ![]() Now you need to build your project again, the same way we did up above. ![]() This time to build succeeded, and you should find an executable in "<project location>/Debug/" but we don't want this one. Debug is used to find and fix bugs. These executables are very large, and contain extra code to help Visual Studio detect bugs. We want a "Release" file, one that does not have the debug information contained within it. Look up top and you should see a dropdown box that says "Debug" which is to the left of a play button. Change it to say "Release", and rebuild. ![]() That should do it for compiling your own server. These same steps will work as a general method for other software and coding languages as well. What will change is the "Project Type" that we selected earlier based on the language and type of software. Some languages use non-Microsoft compilers, but even these generally follow the same basic steps. Create a project, select type, add your source, compile, add missing libraries, compile again. If you have questions on specifics, or methods, just drop them here. If you have questions on ZLIB and you did not follow ZLIB's directions, then don't ask until you did what they require first. |
|||
|
03-09-2010, 06:12 AM
Post: #2
|
|||
|
|||
|
RE: Compiling MienrCPP
Nice guide!
|
|||
|
03-09-2010, 06:52 AM
Post: #3
|
|||
|
|||
|
RE: Compiling MienrCPP
Excellent tutorial. I was thinking about trying to code some custom commands.
|
|||
|
03-09-2010, 06:56 AM
Post: #4
|
|||
|
|||
|
RE: Compiling MienrCPP
OH, Lol:
You misspelles "minerCPP" in the thread title.
|
|||
|
03-09-2010, 07:48 AM
Post: #5
|
|||
|
|||
|
RE: Compiling MienrCPP
Maybe its intentional and nazis bought them out.
|
|||
|
03-09-2010, 07:50 AM
Post: #6
|
|||
|
|||
RE: Compiling MienrCPP
(03-09-2010 06:56 AM)dag10 Wrote: OH, Lol: It's fixed
Man is the animal that has made friends with the fire. - Henry Van Dyke |
|||
|
03-12-2010, 01:57 AM
Post: #7
|
|||
|
|||
|
RE: Compiling minerCPP
Ive downloaded the source from the svn and attempted a couple of times to compile either of the versions on there but I cant get them to work
![]() C++ isn't really my language (basic understanding of how it works etc, just so you know) Ive followed your guide and read the bits that came with zlib and the zlib problems went away. when compiling the code in trunk i get one error: Code: 1>network.cpp(59) : error C4716: 'Network::step' : must return a valueand with the branch code, i get 4 errors: Code: 1>server.cpp(1854) : error C2086: 'std::vector<_Ty> backupFiles' : redefinitionIf its a simple problem, and you care to enlighten me i would be grateful (?), if not i'll just go back to the code in the zip file as that works fine. Thanks |
|||
|
03-12-2010, 10:22 AM
Post: #8
|
|||
|
|||
RE: Compiling minerCPP
(03-12-2010 01:57 AM)NickSlash Wrote: Ive downloaded the source from the svn and attempted a couple of times to compile either of the versions on there but I cant get them to work Yeah, samething here. I think it's because they haven't finished these stuff yet. (You can fix the trunk error, adding a return value, but you will get a run time exception...) |
|||
|
03-12-2010, 11:29 AM
Post: #9
|
|||
|
|||
|
RE: Compiling minerCPP
I didn't see those because of my compiler. They will be updated and fixed in the next few hours.
-Twdtwd |
|||
|
03-12-2010, 07:58 PM
Post: #10
|
|||
|
|||
|
RE: Compiling minerCPP
I keep getting "error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'". Nothing I do will fix it. Plus there are a few more errors that produce when I try to compile rev620.
Code: 1>..\..\..\..\..\Desktop\Minecraft\Compile Server\branch\Server.cpp(1976) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::append(const std::basic_string<_Elem,_Traits,_Ax> &)' : cannot convert parameter 1 from 'WCHAR [260]' to 'const std::basic_string<_Elem,_Traits,_Ax> &' |
|||
|
« Next Oldest | Next Newest »
|

![[Image: Step1.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step1.jpg)
![[Image: Step2.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step2.jpg)
![[Image: Step3.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step3.jpg)
![[Image: Step4.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step4.jpg)
![[Image: Step5.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step5.jpg)
![[Image: Step6.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step6.jpg)
![[Image: Step7.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step7.jpg)
![[Image: Step8.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step8.jpg)
![[Image: Step9.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step9.jpg)
![[Image: Step10.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step10.jpg)
![[Image: Step11.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step11.jpg)
![[Image: Step12.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step12.jpg)
![[Image: Step13.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step13.jpg)
![[Image: Step14.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step14.jpg)


