Home > Back-end >  Consult under Windows GCC batch compiler under multiple folders. C file
Consult under Windows GCC batch compiler under multiple folders. C file

Time:10-06

Consult everybody
The situation is to have thousands of folders, each folder have 1-2. C file
Has been installed in a Windows environment GCC and makefile environment

Could you tell me how to batch compiler under multiple folders. C files? Generated exe

It is better to meet the following requirements:
1, to be able to configure different optimization option (without optimization, - O1, O2, O3, etc.) generated exe
2, the generated exe folder with the source file
3, different optimizations exe can have different naming (preferably. The file name of c + O1, etc.)

Thank you for your bosses to guide
Now imitate some makefile but can only be generated in the same folder. O file

CodePudding user response:

Write a script file, it suggested that Linux can write a shell, DOS can write a bat
2 script to list your thousands of folders, and respectively into each folder called GCC compiler into o, o links into exe can again
1 optimize parameter can use variables in a script, or by the parameters of the script to set the
3 file name can also be through script variables to set
You first try to write a script, mainly used for loop, set set the environment variable, called GCC commands and command of makefile

Or is there a way is that you use a script in each folder to generate a makefile, finally it is ok to call respectively each makefile



CodePudding user response:

reference 1st floor qybao response:
this is suggested to write a script file, Linux can write a shell, DOS can write a bat
2 script to list your thousands of folders, and respectively into each folder called GCC compiler into o, o links into exe can again
1 optimize parameter can use variables in a script, or by the parameters of the script to set the
3 file name can also be through script variables to set
You first try to write a script, mainly used for loop, set set the environment variable, called GCC commands and command of makefile

Or is there a way is that you use a script in each folder to generate a makefile, finally it is ok to call respectively each makefile

Hello thank you for your answer, I'm need a. C to generate an exe

CodePudding user response:

Scripts can control into a c an exe file
You can be a folder a script
This script decide what is more than a c or c generated exe
Combined had a total script

In fact, you can still use c to write a control program
Inside the program called GCC, and give it to do its own compilation, that is how to deal with will do

CodePudding user response:

Script file is used to do, or just use what language to write a program, the process is as follows:
Start - & gt; Enter the home folder - & gt; Traverse all folders - & gt; All the documents to traverse all folder - & gt; Find. C - & gt; Run a GCC command - & gt; The end of the
  • Related