You are not logged in.

#1 2006-10-10 18:57:55

russ816
Member
Registered: 2006-06-09
Posts: 18

C++ Argument Parser

I'm writing my first C++ application and was wondering with the de facto standard is for parsing command line arguments?

I see that popt is pretty popular but I want to make sure that I'm using something that is pretty standard.

Offline

#2 2006-10-10 20:08:49

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: C++ Argument Parser

I've never seen a good one, though boost's is ok.

The defacto standard is to use gnu getopt_long

Offline

#3 2006-10-10 20:18:19

bboozzoo
Member
From: Poland
Registered: 2006-08-01
Posts: 125

Re: C++ Argument Parser

well getopt is part of POSIX and if portability is in mind that stick to it, if you do know that gnu stuff will be available then geopt_long is bit fancier

Offline

#4 2006-10-11 10:48:15

drakosha
Member
Registered: 2006-01-03
Posts: 253
Website

Re: C++ Argument Parser

there's also popt which is (if i'm not mistaken) even fancier

Offline

#5 2006-10-11 14:40:20

russ816
Member
Registered: 2006-06-09
Posts: 18

Re: C++ Argument Parser

I went with boost becuase it's fairly simple to use and also supports config files. I'm not worried about compatability too much due to the fact that it's just an in house app and it will only be running on Arch. Thanks alot guys.

Offline

#6 2006-10-11 16:58:37

Mythoz
Member
Registered: 2004-04-25
Posts: 58

Re: C++ Argument Parser

GNU Gengetopt can build nice command-line parsers.

Offline

#7 2006-10-11 19:05:44

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: C++ Argument Parser

The plus side of using boost is that you're already depending on boost and can use all the good boost libraries (I personally don't think program_options is very good) - boost::filesystem, boost::threads, boost::asio are all great

Offline

Board footer

Powered by FluxBB