Running C program in Ubuntu [closed] - c

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.

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/

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 do i clear this issue? unable to compile? [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 2 years ago.
Improve this question
got this error
11.43.36 JOB05184 $HASP165 IBMUSERX ENDED AT N1 MAXCC=12 CN(INTERNAL)
IEW2735S DA0F OUTPUT DATA SET FOR DDNAME SYSLMOD HAS INVALID RECORD FORMAT. R
IEW2008I 0F03 PROCESSING COMPLETED. RETURN CODE = 12.
THIS IS MY CODE TO COMPILE:-
//IBMUSERX JOB '285','POLSANI',NOTIFY=&SYSUID,REGION=6M
//JOBPROC JCLLIB ORDER=S1304.ANIL.PROC
//COBCL EXEC COBCL,MEM=HELLPGM1
//COMPILE.SYSIN DD DSN=IBMUSER.RKSH.COBOL(&MEM),DISP=SHR
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD(&MEM),DISP=SHR
PLEASE SOLVE THIS.
No one here can see what program is really being executed in the LKED step for which you have the SYSLMOD override, but it's probably IEWL (the binder, known in ancient times as the Linkage Editor).
No one here can see what the attributes of your IBMUSER.RKSH.LOAD dataset are, but it must have RECFM=U.
No one here can see which compiler you are using, but from your dataset names it appears you are compiling a COBOL program. If you are using a COBOL compiler version later than 4.2.1 your IBMUSER.RKSH.LOAD dataset must be a PDSE (not a PDS). If you are using a version of IBM Enterprise COBOL 4.2.1 or earlier, then your IBMUSER.RKSH.LOAD dataset can be either a PDS or a PDSE. Your compile listing includes which version of the compiler is being invoked.
Your override...
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD(&MEM),DISP=SHR
...should not specify a member name. It should look like this...
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD,DISP=SHR
Documentation for IBM Enterprise COBOL is available here. Documentation for the binder is available here.

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

How do I run a C program from my Windows command prompt? [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 8 years ago.
Improve this question
Using Vim as an editor, I wrote the following simple code in C and saved it as helloworld.c :
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
}
In command prompt, I wrote:
start chrome helloworld.c
This caused my browser to open up the file, but it did not print Hello World. Instead, it just displayed the code I had written. Did I not save it as a C file?
Also, I was wondering how to display the result of my C program inline on command prompt, as I am fairly new to it. While searching the internet, I could not find any answers. Am I supposed to do so from Vim? I learned that you are supposed to do ./ in the gedit command box to display the result inline, but this does not work for the one that comes with Windows.
Please help and thank you for taking the time to read and answer.
As #Ernest Friedman-Hill has already said, you normally have to compile the program. However, there are alternatives.
One alternative is the Tiny C Compiler, from http://bellard.org/tcc/. TCC does allow you to run the program without compiling it.
tcc -run helloworld.c
Does exactly what you want.
The Tiny C Compiler is not the only way to run C code from source without compiling it first. There are a few other alternatives.
CSL: http://csl.sourceforge.net/csl.html
Ch: https://www.softintegration.com/
PicoC: https://code.google.com/p/picoc/
CINT: http://root.cern.ch/drupal/content/cint
I hope this helps.

Resources