tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

HELP! - Why does my program not compile?!

Tue Mar 20, 2018 11:09 pm

HI, so I am using gcc myprog.c -o myprog -Wall -std=gnu99 to compile code, I am sure it has worked before tonigth, however its clearly not working tonight, as I have done code changes and its still running an old version of the code... I checked this as well by changing the line to be

gcc myprog.c -o myprog1 -Wall -std=gnu99 in order to produce a new version, however it is clearly still running the previous code changes which makes me think that compiling isn't compiling the changes.

I am using raspbian on pi Z running headless mode and therefore coding from the terminal. Changes should be obvious (Change from sending something to one email address to a different email address).

I am running the program via a Cron event. (I have changed the file to be run in Crontab to point at the new file!)

Any ideas/ Thoughts / Pointers?

Thanks
Tom

W. H. Heydt
Posts: 10279
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: HELP! - Why does my program not compile?!

Tue Mar 20, 2018 11:20 pm

What error messages is gcc giving? Have you double checked the syntax of your changes? Are you sure the problem is that it isn't compiling (since you say the change is an e-mail address ID) or a perhaps the new ID doesn't exist and it's the execution that is failing?

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: HELP! - Why does my program not compile?!

Tue Mar 20, 2018 11:26 pm

HI, I get no error!... The new email address id exists as its my own email address!, So I changed the email address to the new one, however when the code is run via cron, the code sends data to the old email address!!

User avatar
Paeryn
Posts: 2560
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: HELP! - Why does my program not compile?!

Wed Mar 21, 2018 12:00 am

Do you have another copy of the (original) program in another directory or something which cron is running? Does running the newly compiled version directly from the command line produce the correct result?
She who travels light — forgot something.

W. H. Heydt
Posts: 10279
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: HELP! - Why does my program not compile?!

Wed Mar 21, 2018 12:23 am

tig124 wrote:
Tue Mar 20, 2018 11:26 pm
HI, I get no error!... The new email address id exists as its my own email address!, So I changed the email address to the new one, however when the code is run via cron, the code sends data to the old email address!!
If you got no errors, then your program is compiling just fine. I am presuming for purposes of this thread that, besides compiling the program, you have done linkage editing as well.

Cron doesn't have the normal environment settings you get with a login shell. Are you pointing the crontab entry to the newly compiled program, either by replacing the old executable or by changing the path to point to the new one?

dgordon42
Posts: 755
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: HELP! - Why does my program not compile?!

Wed Mar 21, 2018 5:18 pm

tig124 wrote: as I have done code changes and its still running an old version of the code...
It's also worth checking that the new file is correctly written to your SD card.
Sometimes SD cards can go "read only", it's one of the first signs of SD card failure, and results in 'old' versions of files appearing, especially after a reboot.

Hope this helps,
Dave.

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: HELP! - Why does my program not compile?!

Wed Mar 21, 2018 10:27 pm

Ahhhhh! SD Card failure! Thanks - its odd as I delete the file, recompile it and the same outcome happens - going to try a new SD card!

Will let all know how I get on

Thanks
Tom

Return to “General discussion”