I recently studied boost. Because I have been using a MAC system, I want to study boost on Mac. Because boost is open-source cross-platform, I want to use the Eclipse IDE, because it is also cross-platform.
1. download the latest eclipse + CDT for Mac version.
2. Install the latest gcc48, Sudo port install gcc48
3. Use eclipse to create a C ++ Project, Select cross GCC for toolchains,
In the last step of the project creation wizard, write down the GCC directory. If the GCC directory is installed using port, the directory is:/opt/local/bin /,
. Because c ++ 11 is used, you need to configure it to support C ++ 11. I have introduced the eclipse CDT C ++ 11 configuration in my previous article.
4. Download boost source codeAnd compile. The library directory I generated is:/users/haven/desktop/workspace/Boost/which contains two folders: Include and Lib.
5. Configure eclipse to support boost during compilation
Project-> properties-> C/C ++ general-> path and symbols
Add the boost header file directory in include. My files are/users/haven/desktop/workspace/Boost/include.
Add the boost library directory in the library paths. my options are/users/haven/desktop/workspace/Boost/lib.
Add the boost library you used in libraries. For example, I used boost_system (delete the file name in the lib directory, remove the Lib above, and remove the suffix)
6. Configure eclipse to support boost in run/debug(This step is very important. I did not do this step, and the result can be compiled successfully, but the operation is not successful, so I cannot load the dynamic library)
Click the drop-down arrow of running> RUN deployments,
Under C/C ++ application, select the program you want to run, environment on the right, and create an environment variable named "dyld_library_path". The value is: /users/haven/desktop/workspace/Boost/lib (your boost library directory, so that you can load the library during running ).
After completing step 1, I must restart my computer. I didn't restart my computer, and I couldn't live or die. I couldn't find the reason in the middle of the night. I finally went to sleep after shutting down my computer. I started the computer today and didn't do anything, it can run successfully !!!
Success !!!
After a few days of testing, eclipse + CDT does not support C ++ very well, so I plan to use the netbeans ide. Here I have the netbeans + Mac + boost configuration.