I have a project with a mix of .c and .h files for C code and .cpp and .hpp files for C++. If I attempt to build a TAGS file like this:

etags *.cpp *.hpp ../../libs/*.c ../../libs/*.h ../../libs/*.cpp ../../*.hpp
../../*.hpp: Invalid argument

I get the error as above. but without the ../../*.hpp it works fine. Version of etags is 27.1 - running on Windows.

$ etags --version
etags (GNU Emacs 27.1)

Is there a way I can add the C++ header files without having to change all the file suffixes to .h?

1 Answer 1


Recall that wildcards are expanded by the shell before the program is run, and then reread the error message:

../../*.hpp: Invalid argument

If the shell expanded this wildcard, how could etags print it back out? The answer is that it could not. The shell tried to expand the argument, but it found no files that matched. Finding no matching files, it left the argument as–is, even though it looked like a wildcard. Etags tried to understand it, but it doesn’t name a file that exists on disk and it isn’t a valid option, so it printed an error message instead.

Perhaps you should have typed ../../libs/*.hpp, or something else, instead?

  • omg, didn't notice the incorrect path!
    – arcomber
    Commented Feb 3 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.