Compile fastdfs in eclipse

Source: Internet
Author: User

To better use fastdfs (hereinafter referred to as "DFS"), we need to do some small-scale DIY on DFS. I chatted with the author of DFS and found that DFS is executing make. Sh file to generate makefile, and then call make to compile and execute the file. In this way, some friends who need to change may be confused in eclipse. It took me one night, finally, the DFS is successfully compiled in the eclipse environment.

My environment is as follows. In ub9.04, I upgraded the Chinese Language Pack and jdk1.6. Eclipse is the latest from eclipse. The CDT version on the org site. Configure now:

1. Configure the Java environment, start eclipse, and use a lot of G on the Internet;

2. Create a new project name. It is best to select the "Hello World executable project" type (I have never tried other projects );

3. Copy all DFS files;

4. Configure the compiler. Note that DFS generation is implemented through make. Sh. Therefore, we need to change the default compilation method of the project to make. Sh. First, right-click the project, select properties, and set it. You need to change the builder command section:

5. Because CDT includes a part of the library application path by default, applications between projects need to be added by themselves. (I don't know if there will be something without it, because the compilation is done through make. sh. It's not enough to make CDT. If you don't reference it, you don't know if it will make an error. You haven't tried it. If you are interested, you can try it .) (The first green button in the upper right corner adds the reference path ):

6. Adjust your make. Sh. Why is it adjusted? During compilation, your current working directory is either the DFS root directory or make. sh file directory, while make. sh adds a lot of relative path applications, so you need to locate make before searching for other files in DFS compilation. sh directory. Otherwise, compilation fails. Because you are executing a sh file, you can convert the working directory as soon as you enter the sh file. add a sentence to the make. Sh file header:

"Physical path of CD make. Sh file"

If you are not at ease, you can add a PWD to print out the current working directory so that you can see it on the console.

Above is my make. after SH is changed, the selected part is added by myself. below is my console feedback during the second compilation. First, the second line is the currently executed compilation command, one is the text displayed by the "PWD" command.

In this way, the DFS source code can be compiled in the CDT. However, this method is only available in Linux. Cygwin needs to be installed in the window, but I have never tried it. I will share it with you next time.

To sum up what happened above, the correct path directly affects whether or notProgram. In the future, we will pay more attention to path issues on the Linux platform. Especially when the absolute path and relative path are mixed, be careful.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.