0% found this document useful (0 votes)
19 views2 pages

ExecutionProcedure - Codeblock

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

ExecutionProcedure - Codeblock

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

To execute the above program in Code::Blocks, follow these steps:

1. Set Up the Project in Code::Blocks

1. Open Code::Blocks.

2. Go to File > New > Project.

3. Select Console Application (for a simple C++ project) and click Go.

4. Choose C++ as the programming language and click Next.

5. Name your project (e.g., "GTFS_Network") and specify the location for the project files.

6. Click Finish to create the project.

2. Add Source Files to the Project

1. Right-click on the project in the Project pane on the left and select Add Files....

2. Select all the source files:

o main.cpp

o CSVReader.cpp (assuming you’ve created this file based on the earlier description)

o Network.cpp

3. Click Open, then Add them to the project.

4. Repeat this process to add the header files (CSVReader.h, Network.h, types.h).

3. Configure Project Properties

1. Right-click on the project in the Project pane and select Build Options....

2. Under Compiler Settings > Compiler Flags, ensure that any required flags for C++ (such as C+
+11 or later) are enabled.

o If using C++11 or later, check Have g++ follow the C++11 ISO C++ language standard
(or C++17/C++20 if needed).

3. Click OK.

4. Set Up the Makefile (Optional)

If you are using a Makefile instead of the default build system, do the following:

1. Go to Project > Properties.

2. Check This is a custom Makefile and specify the path to your Makefile.

3. Make sure your Makefile is set up to compile all .cpp files and link them.

Example Makefile:

# Makefile for GTFS_Network project


CXX = g++

CXXFLAGS = -std=c++11 -Wall

SOURCES = main.cpp CSVReader.cpp Network.cpp

HEADERS = CSVReader.h Network.h types.h

TARGET = GTFS_Network

$(TARGET): $(SOURCES) $(HEADERS)

$(CXX) $(CXXFLAGS) $(SOURCES) -o $(TARGET)

clean:

rm -f $(TARGET)

4. Run the make command by opening a Terminal and navigating to the project directory, then
typing:

make

Or, you can build directly from Code::Blocks using Build > Build Project.

5. Compile and Run the Program


1. Make sure all files are saved and the correct d:\\Datafiles path (or other) is set in main.cpp.
2. Click Build > Build (or press F9) to compile the project.
3. If there are no compilation errors, click Build > Run (or press Ctrl+F10) to execute the
program.

6. View the Output

The output should appear in the Code::Blocks console window and should display all the
GTFS data as described in the sample output.

This setup will allow you to compile, build, and execute the program in Code::Blocks with the
appropriate structure for handling GTFS data files. Make sure that the GTFS .txt files are present in
the specified directory (d:\\Datafiles), or adjust the path as needed.

You might also like