Author Topic: Object file not being updated  (Read 7613 times)

Offline Jec1201961

  • Single posting newcomer
  • *
  • Posts: 4
Object file not being updated
« on: January 18, 2016, 01:10:32 am »
So I install codeblocks

Write the traditional hello world program, compile, build and run it. It works

I make some changes to refresh my C Skills.. Very rusty

//C hello world example
#include <stdio.h>

int main()
{
    char InString[10]="Hello6789";
    int Counter;

    for ( Counter = 0;Counter <= 10; Counter++ )
    {
        printf("Value of Counter is: %d\n", Counter);
    }
  return 0;
}

I get a warning about the unused InString variable..  no big deal.  It compiles, builds and when I run it, it still says Hello World.

The obj and/or exe file are not being updated.

I am not sure why..  any help appreciated

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jec1201961

  • Single posting newcomer
  • *
  • Posts: 4
Re: Object file not being updated
« Reply #2 on: January 19, 2016, 12:08:20 am »
so I read the link..  here is my build log

mingw32-g++.exe  -o bin\Debug\CleanString.exe obj\Debug\main.o obj\Debug\TestProg.o   
mingw32-g++.exe: error: obj\Debug\main.o: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))

I understand the main.o is missing but I have no idea how to get it back

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Object file not being updated
« Reply #3 on: January 19, 2016, 11:29:06 am »
please make a "Build->clean" and then "Build->Build" and repost the log (this steps are exactly described in the FAQ http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F ). In your log, we can only see that the main.o is missing, but not why. If the "Build->clean" is greyed out, you are not using a project.  For that case see this: http://forums.codeblocks.org/index.php/topic,20845.msg142383.html#msg142383

greetings

Offline Jec1201961

  • Single posting newcomer
  • *
  • Posts: 4
Re: Object file not being updated
« Reply #4 on: January 20, 2016, 12:41:59 am »
Did the Build--> Clean

Log Entries


-------------- Clean: Debug in CleanString (compiler: GNU GCC Compiler)---------------

Cleaned "CleanString - Debug"
Done.

Next I did the Build ---> Build

Log Entries

||=== Build: Debug in CleanString (compiler: GNU GCC Compiler) ===|
||WARNING: Can't read file's timestamp: H:\CodeBlocks Projects\C Stuff\CleanString\main.c|
 obj\Debug\main.o||No such file or directory|
||=== Build failed: 1 error(s), 1 warning(s) (0 minute(s), 1 second(s)) ===|


for info, I am using CodeBlocks Version 13.12 o Windows 7


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Object file not being updated
« Reply #5 on: January 20, 2016, 01:11:54 am »
Code
||WARNING: Can't read file's timestamp: H:\CodeBlocks Projects\C Stuff\CleanString\main.c|
 obj\Debug\main.o||No such file or directory|

hmm... This means c::b can't read the timestamp of your main.c file. I remeber  that other had the same issue, but i can't remember the solution ;) .
You can try the following:
  • Make sure that no anti virus is blocking c::b -> Add the c::b folder and your project folder to the ignore list of your anti virus
  • Check if you have the reading and writing permissions in your project folder
  • Search the forum for this error message, im quite sure someone had the same problem and found a solution...

Ps. For future posts, please post your code and all logs in code tags (the # symbol in the "post reply" editor, or you enter them from hand: "[code ] Here comes your log/ code [/code ]" you have to remove the empty spaces between the []

greetigns

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Object file not being updated
« Reply #6 on: January 20, 2016, 01:23:36 am »
Ok, i searched a bit the forum and it seems that this problem occurs if the file does not exists anymore on the harddrive, so some more stpes you can try, and please report back if something worked:
  • Check if the file "H:\CodeBlocks Projects\C Stuff\CleanString\main.c" exists
  • Check if you can read and write in this file
  • Try the Plugins->Find broken files in project plugin
  • Has this file a strange symbol in the project manager (on the left site of the window). If yes remove and read the file
  • Never ever use white spaces and special characters that are non aschii in your paths (this leads to strange errors somethimes) use _ instead of spaces...*
  • Try a new "Hello World" project
  • Copy your code in this new project

i hope this helps
greetings

*interestingly i have a lot less problems with white spaces and special symbols under linux, windows sucks in this place pretty hard, specially if you copy files from windows to linux and vice versa

Offline Jec1201961

  • Single posting newcomer
  • *
  • Posts: 4
Re: Object file not being updated
« Reply #7 on: January 20, 2016, 03:05:14 am »
Thank you.

The file main.c was missing.

After i ran the plugin "find broken files in project". It gave me the option to remove the broken files. 

I ran Build ---> Clean
The Build ----> Build and voilla, back in business