[TODO: this file is probably out-of-date]
Use the following installation steps to setup an Eclipse development environment for p4c. Note that the following assumes you have already performed the preliminary environment bootstrap, as described in README.
- Download Eclipse Luna for C/C++ from Eclipse webpage
- Go to Downloads -> Eclipse IDS for C/C++ Developers -> Linux 64-bit
-
tar xvfz eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz
-
Move
eclipse
folder to desired location. -
Open Eclipse
-
Create workspace
-
Go to Help -> Eclipse Marketplace...
- Search for c++
- Check that Eclipse CDT (C/C++ Development Tooling) is installed (it was for me)
- If not, install it.
- Create a new C++ project from File -> New -> Project
- Select C/C++ -> Makefile Project with Existing Code, click Next
- For the Project Name enter something like
p4c
- Navigate to the directory that contains the
p4c
directory, something like/home/mike/p4c
- Check the C and C++ boxes
- Select
GNU Autotools Toolchain
as the Toolchain for Indexer Settings
- Setup C++11 support
- Right click your project and click Properties
- Under C/C++ General, click
Preprocessor Include Paths, Macros etc.
- Select the
Providers
tab - Highlight the
CDT GCC Built-in Compiler Settings
- Uncheck
Use global provider shared between projects
box - In the box labeled
Command to get compiler specs
, add-std=c++11
- Move
CDT GCC Built-in Compiler Settings
to the top by repeatedly clickingMove Up
- Click
Apply
and thenOK
- Add C++11 support to
Window
- Go to Window -> Preferences
- Go to C/C++ -> Build -> Settings
- Click the
Discovery
tab - Highlight
CDT GCC Built-in Compiler Settings [Shared]
- In the box labeled
Command to get compiler specs
, add-std=c++11
- Click
Apply
9.5. Change the build location
- Project -> Properties
- Select C/C++ build
- In the build location choose "FileSystem" and browse to the p4c/build folder.
- Add additional include files needed by your sub-project to include path
- Right click your project and click Properties
- Highlight C/C++ General -> Paths and Symbols
- In the
Includes
tab, highlightGNU C++
- Click
Add
and thenFile system...
and navigate to header files that you need to include - Click
OK
- Right click project and go to
Index
- Select
Re-resolve Unresolved Includes
- Right click project and go to
Index
- Select
Rebuild
- Wait for indexer to complete
-
Close Eclipse and then open it again.
-
Setup build
- This seemed to "just work" for me. I clicked build, and it ran make.
- Setup Run
- Under
Run Configurations
I was able to navigate to this file and add command arguments.
- Setup editor
- Window/Preferences/Text editor -> insert spaces for tabs