c How do I compile multiple source files in it?

Updated on technology 2024-04-03
6 answers
  1. Anonymous users2024-02-07

    1。Click the "File" menu button and select "New";

    3。Don't rush to press OK, select the tab next to "File", then select "C source file", and enter the file name (to. cEnd e.g.: Press OK;

    4。at the suffix. c's input source in the text box**;

    5。There are some six small icons on the right side of the text box,Compile (the name of these icons will appear on these icons for a long time),build,go, etc.,Press from the leftmost icon (compile), the pop-up dialog box is OK, one icon OK is pressed one, the last one is go, I don't remember it very much, but OK will appear in the DOS dialog box.

    OK, that's it, I won't have a lot of them, some are header files and source files, so in the second step, you should pay attention to whether to choose "C source file" or "C header file"!

    Of course, you can also choose "C source file" or "C header file"! Note that CPP is a dropout of C++ filesC is a dropout of the C language.

  2. Anonymous users2024-02-06

    Different compilers have different methods.

  3. Anonymous users2024-02-05

    In C, multiple source files can be used to write a program. You can divide a program into modules, each corresponding to a source file. When working with multiple source files, there are two ways to compile and run multiple source files at the same time:

    Compile multiple source files into one executable file.

    In this approach, multiple source files can be compiled into a single executable using a single command. For example, let's say you have two source files and you can use the following command to compile them into an executable file:

    gogcc -o program

    where gcc is the command of the compiler, and is the source file, and -o program specifies the name of the executable as program.

    Compile multiple source files into multiple objects and link them into an executable file.

    In this approach, multiple source files can be compiled separately into an object file and then linked into an executable file. For example, if you have two source files and two files, you can compile them separately into object files using the following command:

    rgcc -c

    gcc -c

    The -c option indicates that only the source files are compiled and not linked. After compilation, two objects are generated and.

    gogcc -o program

    where and is the object file, and -o program specifies the name of the executable file as program.

    Both methods can compile and run multiple source files at the same time, and the specific method can be selected according to the actual situation.

  4. Anonymous users2024-02-04

    First question.

    Please, should I do it:

    In include

    Also include in the middle

    It seems to be required, please explain in detail)

    This is required. Because the compiler just copies the ** that contains the file, since you use the content of the header file in both files, of course you must include the header file, otherwise there will be an error.

    My point of view, if both of these steps are required.

    So when there are many, say, 10. The C program should include in each section

    Then the file is not going to be particularly large when there are 100. Isn't it very repetitive? )

    That, of course, will be repeated. However, this has no effect on the running efficiency of the program.,It's just that the analysis of the file during the compilation process will take a little longer.,It's also a matter of no choice.,It all depends on how the writer organizes the structure.。

    Second question:

    Yes. The solution to this problem is to add pragma to the beginning of a header file that may be included multiple times

    once, which would ensure that the header file is executed only once, without causing the function in the header file to be redefined multiple times. Of course, you can also use precompiled processing such as ifdef to solve the problem yourself. Isn't that the case with the question you're asking?

    and both contain header files.

    The third question:

    When I'm in this way.

    #define

    unchar

    unsigned

    char then when I am in the need to recreate the replacement macro unchar.

    Can I use it without creating it?

    The answer is that it needs to be recreated, and it cannot be used directly. However, you can unify some macros, global variables, etc., that are used in multiple files into a single header file, so that you can avoid multiple definitions.

  5. Anonymous users2024-02-03

    You should build the project with an IDE like VC, and then add all the files to the project, so that you can write it as include

    h up. I don't know exactly how it works, but I guess the IDE automatically sets it at compile time. c file into a library, which is then compiled from the . H header file jujube comic to "index" these functions wide rock staring.

  6. Anonymous users2024-02-02

    Visual C++ is a C C++ IDE launched by Microsoft in 1998, with a friendly interface and powerful debugging functions. It is a revolutionary product, very classic, and is still used by many enterprises and individuals, and many colleges and universities will also use it as the basis for teaching C language and as a tool for computer experiments. The ** in this tutorial is also run through the next run.

    It's a bit old, if it's not a school requirement or a project need, it is recommended to use Visual Studio instead, the reason why it's explained here is to take care of school students or readers with special needs.

    Install the program under the C language.

    Open, select "File -> New" in the menu bar, or Ctrl+N, and the following dialog box will pop up

    Click the "Finish" button to complete the creation of the project.

    2) Create a new C source file.

    In the menu bar, select File -> New, or Ctrl+N, and the following dialog box will pop up

    Switch to the "File" tab, select "C++ Source File", fill in the file name, and click OK to finish.

    This step is to add the source file to the project you just created.

    3) Write C language**.

    In the workspace, you can see the project and source files you just created, as shown in the following figure

    Double-click to enter the interface and enter ** in the previous section.

    4) Compile and run.

    You can find the functions of compiling, compiling, and running in the "Build" menu, as shown in the following image:

    An easier way to do this is to use a shortcut, as shown in the following image:

    Note: Compile the generated .The exe file is located in the debug folder in the project directory. Take the above project as an example, the path is e:cdemo, open it and see that there is a debug folder, enter it and you can see it.

    You will also see a file named in the debug directoryobj is the object file generated by vc vs, similar to under c-free. o Files.

    Description of the project file.

Related questions
18 answers2024-04-03

As long as the file is not overwritten by other data, it can be recovered. >>>More

9 answers2024-04-03

Open the folder.

Later, you can't find the file or subfolder you need, which is usually because the system defaults to "Don't show hidden files, folders, or drives, and the properties of the file or subfolder are set to "hidden". Just tweak this feature selection. >>>More

7 answers2024-04-03

1. If the file was saved on the computer but has been deleted. You can try data recovery related software to retrieve it, but if the disk is accessed multiple times, the probability of retrieval is relatively low. >>>More

27 answers2024-04-03

As the name suggests, lobby means hall, corridor, and dir means directory, and when connected, it is a hall directory, so it's actually a JJ game. >>>More

4 answers2024-04-03

What to do if you have fleas on your cat?