How do I run another C program from the console? I have tried researching and cannot find anything.
You need to compile it.
then you can run it in a shell. Just make sure you use ./ in front of the name
Okay, I compiled it. But then what is the command to execute it within the shell? When I last looked, it compiles into .exe. Is this able to run in the shell at the file format?
You can run the executable but since probably the path is nit set put ./ in front of the name.
@whileTRUEpass Very well. I am asking this for a C projects named B-OS that I am working on: https://replit.com/@OSoft/B-OS-Alpha-Pre-Release?v=1
Open a shell (not console) and type ./main hit return and it should work. The executable is called main but you need the path to is that is ./, hence ./main
I reproduced this error. Can you explain this?
Well you have an error, so it did not compile. I would need to delve into your code but I am on an iPad flying over Boston and is kind of difficult to debug code like this,
I thought airplane mode was a thing. laughs
The only issue seems to be that the setup_main
function is missing a main
function to call it.
You can buy internet these days but I would need a laptop to see the code well.
Is there a main func in the setup.c? Is setup.c your am or main.c?
setup.c
is an arbitrary program I created for the main user home file. My main.c
file is the main one, and runs the prompt engine. Primarily, my objective is to have the user use a custom made command such as rn setup
or rn setup.c
to run a specific program within that directory. When the program finishes, the prompt returns to the main.c
prompt. The problem is that I can’t have two int mains
. But then when I compile, it says it is missing.
That is a different problem than the original one. I suggest you post it with details again as a new post and it will attract lot of attention from the few c users here.
run this in shell:
make -s; ./main
I did, it worked. But I would like to run “make -s; home.u/user/setup.c”. So, yes, you have solved my problem, but now it says permission denied. How do I fix this.
Run this:
make -s # compile all directories recursively iirc
chmod u+x ./home.u/user/setup.c # make setup.c executable
# (changes the perms of the user for this file)
./home.u/user/setup.c # run it
I want it to be able to run without compiling and turning it into an EXE. This problem is a permission problem. I need to give the system permission to the folder. I am pretty sure that there is a command for that.
yeah… that’s it chmod
changes the perms of a file so that you can read/write to it
So then would I command chmod home.u/user
?
No, you would run:
make -s # compile all directories recursively iirc
# changes the permissions so you can access the compiled ver
# important that you add `u+x` because that means you can actually read/write
chmod u+x ./home.u/user/setup.c
./home.u/user/setup.c # run it