A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fatal-command-line-duplicate-option-example.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Lawrence Livermore National Laboratory
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
7 */
8#include "ns3/command-line.h"
9
10/**
11 * @file
12 * @ingroup core-examples
13 * @ingroup commandline
14 * Example program illustrate the abort due to duplicate non-option in ns3::CommandLine.
15 */
16
17using namespace ns3;
18
19int
20main(int argc, char* argv[])
21{
22 int intArg = 1;
23 int intArg2 = 1;
24 CommandLine cmd(__FILE__);
25 cmd.Usage("This program is expected to abort due to duplicate option definition.");
26 cmd.AddValue("intArg", "int argument", intArg);
27 cmd.AddValue("intArg", "int argument", intArg2);
28 cmd.Parse(argc, argv);
29 return 0;
30}
Parse command-line arguments.
Every class exported by the ns3 library is enclosed in the ns3 namespace.