eclipse, c, auto increment build number define [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm using LPCXpresso (Eclipse) that is building C code for some MCU.
Is there some magic feature (plugin) that I can use to automatic increment a define?
#define BUILD_NUMBER 1252 // auto increment at each build
Few years ago I wrote some simple exec for doing that on older IDEs (pre build events) but there may be a simpler solution now.
Thank you in advance,

You can this to use to store your build number and create an header at a pre-build stage by makefile, eg:
#id=`cat .build_id`; id=$$[id+1]; printf "#define BUILD_NUMBER\t\t0x%08X\n" $$id >> $#; echo "$$id" > .build_id
You can also add date and time, eg:
#printf "#define BUILD_DATE\t\t0x%04X%02X%02X\n" `date +"%-Y %-m %-d"` >> $#;
#printf "#define BUILD_TIME\t\t0x%02X%02X%02X\n" `date +"%-H %-M %-S"` >> $#;

Related

What do I do when i receive this feedback after running a code in C? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 months ago.
Improve this question
Feedback after running code in vscode;
gcc : The term 'gcc' is not recognized as the name
of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a
path was included, verify that the path is correct
and try again.
At line:1 char:40
The code I input;
#include<stdio.h>
int main() {
printf("Hello World")
}
you need to install the gcc compiler on your system and it add to path. here u can take help.
https://www.scaler.com/topics/c/c-compiler-for-windows/

Running C program in Ubuntu [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a set of C code files named as: hmc.c hopping.c phi4.c and I have an 'infile' which contains value of parameters and a 'Makefile'. How do I run these set of files in Ubuntu?
Previously in Windows I used gcc compiler with command 'gcc hmc.c hopping.c phi4.c' and then press Enter and then 'a infile' and that did the expected job but on Ubunut it isn't working..
Running the makefile should compile and give you an executable. You can do so by entering make in the command line. Make sure you have it installed first.

C language Redirection [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I have been asked to make a program named easter.c Now this program involves file handling. Now whenever I try to run the redirection, the terminals shows a message
zsh: command not found: easter
Following is the screenshot. Kindly view the screenshot and help.
./easter
or
export PATH=.:$PATH
Ideally, we should add the complete path of the current directory instead of .

How can I read a line from a file and check if that row contains an #include for call an header file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to read all the content of a .c file and print out in another .o file all the source code of the first file, replacing all the #include <....> in this way:
Input: #include<string.h>
Ouput: "string.h"
I have to work in pure C, without the chance to use any C++ libraries
Can someone please help me with this issue?
A simple sed on your file maybe?
sed 's/.*#include *\(<|"\)\(.*\)\(>|"\).*/"\2"/' < input.c > output.o

GCC link a directory [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I want compile a .c script with the gcc-compiler.
But i need to link a file and a directory. I need to link the file python3.lib and the directory D:\Python33\include.
But the linker doesn't work, here my code:
gcc main.c -lpython3 -l D:\Python33\include
The Error:
main.c:1:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
What is wrong? Thank you for help!
You are passing wrong parameters to gcc.
gcc main.c -L /path/to/lib/file/directory -lpython3 -I D:\Python33\include
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^

Resources