Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to use wildcards in c++ #include statements? [duplicate]

Tags:

c++

include

This seems like fairly basic functionality but, everywhere I look, the answer seems to be no.

Here's the thing: I've got a folder full of files I need to include in a c++ application. They're all named "FileX.h" where X is a number from 1 to 400. I did this because I figured there was a way I could say something like #include "File*.h" and it would include every file that fits that pattern. The order in which the files are included does not matter. I realize now I probably should have made the files into a shared library or something similar but, for future reference, I'd really like to know if this is possible.

So, is there someway to include all of these files with one #include statement? Or, failing that, is there a way to include a whole directory worth of files (ie. #include "C:/project/includes/") in c++?

like image 852
Hoyt Avatar asked Nov 10 '12 17:11

Hoyt


People also ask

What is a wildcard in C?

Alternatively referred to as a wild character or wildcard character, a wildcard is a symbol used to replace or represent one or more characters. The most common wildcards are the asterisk (*), which represents one or more characters, and question mark (?), which represents a single character.

Can queries use wildcard characters?

Wildcards for use with the Access database engines (ANSI-89)Use these wildcard characters in queries created for an Access database. Matches any number of characters. It can be used as the first or last character in the character string.

When can wildcards be used?

Sep 14, 2022 175876. The wildcard is an advanced search technique that can be used to maximize your search results in library databases. Wildcards are used in search terms to represent one or more other characters.


1 Answers

AFAIC, the answer is no.

If you are doing this same list of files in multiple places, create another master header file that explicitly includes all the header files and then just include that one master header file in all your source files.

Depending on what you have going, there should be some way to automate the creating of this master header file.

like image 200
Jonathan Wood Avatar answered Nov 05 '22 06:11

Jonathan Wood