A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fatal-command-line-duplicate-non-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
9#include "ns3/core-module.h"
10
11#include <iomanip>
12#include <iostream>
13#include <string>
14
15/**
16 * @file
17 * @ingroup core-examples
18 * @ingroup commandline
19 * Example program illustrate the abort due to duplicate non-option in ns3::CommandLine.
20 */
21
22using namespace ns3;
23
24int
25main(int argc, char* argv[])
26{
27 int intArg = 1;
28 int intArg2 = 1;
29 CommandLine cmd(__FILE__);
30 cmd.Usage("This program is expected to abort due to duplicate non-option definition.");
31 cmd.AddNonOption("intArg", "int argument", intArg);
32 cmd.AddNonOption("intArg", "int argument", intArg2);
33 cmd.Parse(argc, argv);
34 return 0;
35}
Parse command-line arguments.
Every class exported by the ns3 library is enclosed in the ns3 namespace.