New to programming world: running multiple c programs

ISSUE : AFTER HAVING MADE A NEW FOLDER AS REPOSITORY IN MY REPLS FOR LET’S SAY MY C CODES.
UNDER THIS FOLDER I AM MAKING MULTIPLE FILES IN THE FORMAT MAIN.C AS THE FIRST AUTOMATICALLY GENERATED FILE NAME. AFTER THAT IF I AM MAKING A NEW FILE BY THE NAME FOR THE CODE I.E DEQEUE.C OR STACK.C OR FILENAME.C NONE OF IT IS RUN BY CONSOLE. IT THROWS ERROR BECAUSE OF MAIN.C CODE IN REPLIT.FILE SOUCE CODE. I TRIED MODIFYING IT EVERYTIME TO RUN MY NEW CODE. CAN ANYONE HELP TO GENERATE A GENERALIZE AND A MORE FORMAL SOLUTION FOR THE SAME.

ADDITIONALLY AS OBERVED FROM THE SCREENSHOT I AM TRYING TO RUN STACK.C CODE BUT ITS STILL EXECUTING THE MAIN.C CODE THEREFORE NO ERRORS GENERATED.
c
**NEW TO THE CODING WORLD. HELP AND GUIDANCE APPRECIATED.
REGARDS

To change the default file that is run (in this case MAIN.C to STACK.C), you need to click on the three dots, click on show hidden files, find the .replit file, then change the filename near the first couple lines to STACK.C (originally main.c, then rerun your repl.

BTW: Consider avoiding using ALL CAPS as using it can make you appear like you’re screaming :smile:

OMG I WISH I HAD CANNED REPLIES (WHAT NATEDHALIWAL pOSTED)

2 Likes

Hey @TarunJalota , welcome to the forums!

Just click the next to “Files” then click “Show hidden files”. Next click on the .replit file and finally you can change the entrypoint to whatever file you want to run.

Images

Dots

Show hidden files

edited

You should also see the docs on how to configure a Repl: https://docs.replit.com/programming-ide/configuring-repl

And if you want to run the last edited file, take a look at this post:

Hope this helps!

Doesn’t it need to be STACK.c?

entrypoint doesn’t change the file being run AFAIK

You do, though

not anymore, I was demoted after being silenced (despite still keeping a cached copy of the L3 flair, plz dont remove :pleading_face: )

This is correct, if you’re on the default c template, it attempts to compile all files ending in “.c”.

I’m not sure how compilers work, but if you have main functions defined in both files, only one of them will be executed. (this typically depends on what file the compiler sees first, but I might be wrong)

1 Like

It doesn’t seem to run if there is a main function in both files.

Sometimes it throws a duplicate definition error

1 Like

They probably accidentally pressed the CAPS button

1 Like

also, Linux filenames are case sensitive, and

1 Like