I am building a CLI app that should do something similar to this:
./app
Welcome to the app, Type -h or --help to learn more.
./app -h
list of commands:...
Here is the code i am trying to build:
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "Welcome to the app. Type -h or --help to learn more\n";
if(argv == "-h" || argv == "--help") {
cout << "List of commands:...";
}
return 0;
}
But when i try to compile gcc gives following erros:
error: comparison between distinct pointer types ‘char**’ and ‘const char*’ lacks a cast [-fpermissive]
if(argv == "-h" || argv == "--help") {
^~~~
error: comparison between distinct pointer types ‘char**’ and ‘const char*’ lacks a cast [-fpermissive]
if(argv == "-h" || argv == "--help") {
^~~~~~~~