Difference between revisions of "Configuring C Projects"

From AtlasWiki
Jump to: navigation, search
Line 44: Line 44:
 
#*If the '''Open''' button under '''Build Configuration File''' is grayed out, or if it says zero files were found, then Atlas was unable to detect the build configuration. Select '''C/C++ Build''' and uncheck “Use default build command”.
 
#*If the '''Open''' button under '''Build Configuration File''' is grayed out, or if it says zero files were found, then Atlas was unable to detect the build configuration. Select '''C/C++ Build''' and uncheck “Use default build command”.
 
#*Adjust the command to make the output verbose.  Necessary flags may vary; common options include “V=1” or “VERBOSE=1”.
 
#*Adjust the command to make the output verbose.  Necessary flags may vary; common options include “V=1” or “VERBOSE=1”.
#*Clean and build the project and check that Build Configuration File is nonzero.
+
#*Clean and build the project and check that '''Build Configuration File''' is nonzero.
 
#If Atlas’ code map is still empty, it may be that the Makefile is improperly reporting changing directories.
 
#If Atlas’ code map is still empty, it may be that the Makefile is improperly reporting changing directories.
 
#*Right-click on the project in the package explorer and select '''Properties'''.
 
#*Right-click on the project in the package explorer and select '''Properties'''.

Revision as of 15:10, 18 May 2017

The steps below detail how to import an existing C code base into an Eclipse project and some advanced project configuration this is necessary for large C projects like the Linux Kernel.


Importing C projects in Eclipse

  1. Import, if the project has a Makefile:
    • Right-click in the package explorer.
    • Select Import.
    • In the popup dialogue, expand C/C++, select Existing Code as Makefile Project, and click Next.
    • Enter a project name and indicate the directory to import.
    • Click Finish.
  2. Import, if the project does NOT have a Makefile:
    • Right-click in the package explorer.
    • Select New > Project…
    • In the popup dialogue, select General > Project and click Next.
    • Enter a project name and click Finish.
    • Right-click on the project and select Import.
    • Enter the parent directory, select files to import, and click Finish.


Advanced Set up for C projects

For a typical C project, no further setup is necessary. However, large projects like the Linux kernel have a complicated build system that Atlas must understand in order to map the code correctly. To do this Atlas will analyze the build commands used to build the project. The steps below detail the changes necessary to map only the files built by the make file.

  1. Add the compiler build command:
    • Right-click on the project in the package explorer and select Properties.
    • Under Atlas C/C++ Build, add the name of the compiler used by the project to the Build Commands. Atlas will look for commands sent to these compilers when parsing the output of the project's makefile.
    • Click OK.
  2. Use information from build commands
    • Right-click on the project in the package explorer and select Properties.
    • Select Map only files in current build under Source files to map.
    • Select Use discovered configuration for files in the current build under File configuration.
    • Click OK.


Troubleshooting: If Atlas is unable to properly map the project, try the following fixes:

  1. Clean and build the project and make sure the build output is being correctly parsed:
    • Right-click on the project in the package explorer and select Properties.
    • Look under Atlas C/C++ Build > Build Configuration File.
    • If the Open button under Build Configuration File is grayed out, or if it says zero files were found, then Atlas was unable to detect the build configuration. Select C/C++ Build and uncheck “Use default build command”.
    • Adjust the command to make the output verbose. Necessary flags may vary; common options include “V=1” or “VERBOSE=1”.
    • Clean and build the project and check that Build Configuration File is nonzero.
  2. If Atlas’ code map is still empty, it may be that the Makefile is improperly reporting changing directories.
    • Right-click on the project in the package explorer and select Properties.
    • Select C/C++ Build and uncheck “Use default build command”.
    • Add the flag “--print-directory”.
    • Clean and build the project.


For versions of Atlas before Atlas 3.0, see the set up instructions at Configuring C Projects for Atlas 2.0.


If you experience difficulty in setting up Atlas, please contact [email protected] for assistance.