[Solved] My c++ programs won’t compile after I close the source then open it again

Introduction

If you have been writing C++ programs and have noticed that they won’t compile after you close the source and open it again, you are not alone. This is a common issue that many C++ programmers face. Fortunately, there are a few steps you can take to troubleshoot and resolve the issue. In this article, we will discuss the possible causes of this issue and provide some tips on how to fix it. We will also provide some general advice on how to prevent this issue from occurring in the future.

Solution

There could be a few reasons why your C++ programs won’t compile after you close the source and open it again.

1. You may have forgotten to save your changes before closing the source. Make sure to save your changes before closing the source.

2. You may have made changes to the source code that are causing errors. Check your code for any syntax errors or typos that may be causing the program to not compile.

3. You may have changed the compiler settings. Make sure that the compiler settings are the same as when you first compiled the program.

4. You may have changed the version of the compiler. Make sure that you are using the same version of the compiler as when you first compiled the program.

5. You may have changed the operating system. Make sure that you are using the same operating system as when you first compiled the program.

6. You may have changed the version of the C++ library. Make sure that you are using the same version of the C++ library as when you first compiled the program.

7. You may have changed the version of the linker. Make sure that you are using the same version of the linker as when you first compiled the program.

If none of these solutions work, you may need to contact your compiler vendor for further assistance.


this is caused because you need to link the library libgdi32.a, if you are using the DevC++, click in Tools->Compiler Options, when open the window, check the box “Add these commands to the linker command line” and in the below textbox add the text:

-lgdi32

you form need to be like this:

enter image description here

3

solved My c++ programs won’t compile after I close the source then open it again


Solving the Problem of C++ Programs Not Compiling After Reopening

If you’ve ever experienced the frustration of your C++ programs not compiling after you close the source and open it again, you’re not alone. This is a common issue that can be easily solved with a few simple steps.

Step 1: Check Your Code for Errors

The first step in solving this problem is to check your code for any errors. This can be done by running the program through a compiler and looking for any syntax errors or other issues. If you find any errors, make sure to fix them before continuing.

Step 2: Check Your Compiler Settings

The next step is to check your compiler settings. Make sure that the settings are correct for the version of C++ you are using. If the settings are incorrect, the compiler may not be able to compile your code correctly.

Step 3: Rebuild Your Project

Once you’ve checked your code and compiler settings, the next step is to rebuild your project. This will ensure that all of the necessary files are compiled correctly and that the program will run properly. To do this, simply open the project in your compiler and select the “Rebuild” option.

Step 4: Run the Program Again

Once you’ve rebuilt your project, the final step is to run the program again. This should solve the issue of your C++ programs not compiling after you close the source and open it again. If the problem persists, you may need to look into other potential causes.

Solving the problem of C++ programs not compiling after you close the source and open it again is relatively simple. By following the steps outlined above, you should be able to get your program running again in no time.