Creating a Makefile project
This tutorial describes the process of creating a new project that includes a makefile, and debugging the program.
You need to create a project to contain your source code and related files. A project has an associated builder that can incrementally compile source files as they are changed.
To create a project:
Select File > New > Project.
When you are creating a new project, you are required to specify the project type.
- Select the type of project to create. For this tutorial, expand the C/C++ folder and select CUDA C/C++ Project.
The CUDA C/C++ Project wizard opens.
- In the Project name field, type bitreverse.
- Leave the Use Default Location option selected.
Next, you want to select the type of project to create. In the New Project Wizard, you can choose from the following project types:
Executable - Provides an executable application. This project type folder contains three templates.
- Empty Project provides a single source project folder that contains no files.
After you select this template, the result is a project with only the meta-data files required for the project type. You are expected to provide source files for the project's target.
- CUDA Runtime Project provides a simple bitreverse application that demoes CUDA Runtime APIs
- Import CUDA Sample imports CUDA SDK sample as a workspace project.
- Thrust Project creates a simple bitreverse application that uses Thrust template library to run code on GPU.
The makefile for the Executable project type is automatically created by Nsight.
- Empty Project provides a single source project folder that contains no files.
- Shared Library - An executable module that is compiled and linked separately. When you create a project that uses a shared library (libxx.so), you define your shared library's project as a Project Reference for your application. For this project type, Nsight combines object files together and joins them so they're relocatable and can be shared by many processes. Shared libraries are named using the format libxx.so.version, where version is a number with a default of 1. The libxx.so file usually is a symbolic link to the latest version. The makefile for this project type is automatically created by Nsight.
- Static Library - A collection of object files that you can link into another application (libxx.a). Nsight combines object files (i.e. *.o) into an archive (*.a) that is directly linked into an executable. The makefile for this project type is automatically generated.
- Makefile Project - Creates an empty project without the meta-data files. This selection is useful for importing and modifying existing makefile-based projects; a new makefile is not created for this project type.
- From the Project types list, expand Makefile project and select Empty Project. This project lets you enter the source file and the makefile yourself.
- Select CUDA Toolkit from the Toolchain list.
A toolchain is a set of tools (such as a compiler, linker, and assembler) intended to build your project. Additional tools, such as a debugger, can be associated with a toolchain.
There can be several toolchains available, depending on the compilers installed on your system. - Click Next.
- Click Next on the Basic Settings page.
- (Optional) On the Select Configurations page, Click Advanced Settings.
- Expand C/C++ Build > Settings. Click the Binary Parsers tab.
- In the Binary Parser list, select the error parser that is appropriate for your platform.
Other project settings can be modified here as well. The default selection is probably OK.
To ensure the accuracy of the Project Explorer view and the ability to successfully run and debug your programs, selecting the correct parser is important. After you select the correct parser for your development environment and build your project, you can view the components of the .o file in the Project Explorer view. You can also view the contents of the .o file in the source editor.
Click OK to close the Project Properties window.
- Click Finish.
- If a message box prompts you to change perspectives, click Yes.
Your new project displays in the Project Explorer view. Your project is empty because you have not yet created files for your project. You may see an error since there is nothing to build yet for your project. You can now start writing the code for your HelloWorld program.
Tip: You can view and modify the properties of your bitreverse project at any time by right-clicking on the project in the Project Explorer view and clicking Properties.
For more information about:
- Projects, see Workbench User Guide > Concepts > Workbench > Resources
Overview
Projects
Project file views
