Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: brd24 on July 21, 2013, 11:58:35 am
-
I searched google, but I couldn't fined the answer, so I'll ask here.
I updated my main.c file in my project, and ran the project from the command line.
I tried the following things, but only the last one resulted in a change in the executable file:
1. save main.c
2. save the project
3. compile main.c
4. press F9 and run the project from code::blocks (not the command line)
I understand if I hadn't saved main.c, no change would be reflected.
I also (think) I understand that simply saving the project does not create any object files, so the exe file would stay the same, although I am unsure about this one.
But I do not understand why compiling main.c and therefore creating the object file failed to update the executable file.
Another related question is why when I save project, the files themselves did not get saved.
After changing main.c, and saving the project, the asterisk at the tab of main.c indicates the file is unsaved.
-
Can you give us a detailed steps? I'm not quite understand your question.
ran the project from the command line
What is "run the project" means?
-
Code::Blocks gives you the choice.
1, 2 and 3 do what they pretend to do. Nothing more, nothing less.
That is, if you compile main.c cb will ask the compiler to produce a main.o
but does not call the linker.
In addition to these commands you can always use the combined ones
("save all files", "save everything", "build", "build and run" etc.).
I consider this behaviour actually a feature.
To distinguish between them is helpful, especially in larger projects:
* If you have temporarily set program arguments in your project, and
want to build and run the program several times, but do not want
the arguments to be saved in the project-file permanently. You often
do not want your version-control (eg. mercurial, git) to commit
these temporary things as changes to the project.
* If you just want to see, whether the edited file still compiles (quick) without
being forced to call the linker as well (may take significantly more time).
* Run the existing executable (from previous build) to reverify the current
behaviour before you acually compile and link the changed program.
If you have made changes to the project and are closing it you will be prompted
whether you want to save the changes.
All in all: A Project file gets updated when you tell cb to do so.