Avatar of naseeam
naseeam
Flag for United States of America asked on

How to build c program using make in mingw environment?

I have simple ex1.c that prints a  line on the screen.

I get attached build error.

I create attached makefile but still build error.  make utitlity is not using my makefile.  I specify gcc compiler but it's using some makefile that has cc compiler command.

How do I buld this simple c program with make utility that comes with mingw?
Makefile.txt
build-error.PNG
C

Avatar of undefined
Last Comment
naseeam

8/22/2022 - Mon
evilrix

You need to be running the bash shell that comes with Mingw. Execute the commands in that shell.
naseeam

ASKER
I removed .txt extension from the makefile I had created.   Then, it worked from windows command window.

If i use bash shell then I don't need to create my own makefile?

I invoked bash application from MinGW\msys\1.0\bin.  That's how to run bash shell?
SOLUTION
evilrix

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
naseeam

ASKER
How to invoke bash shell from imingw?
Your help has saved me hundreds of hours of internet surfing.
fblack61
SOLUTION
sarabande

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
naseeam

ASKER
>> yes. what happens if you do so?
bash.exe"--3.1$
sarabande

bash.exe"--3.1$
can you post a picture?

it is some time ago but if i remember rightly of my last mingw installation, they added a menu item into start menu where you could open a bash shell command window.

are you familar with using bash shell? or any other shell?

if not, i would strongly recommend to using an IDE.

Sara
ASKER CERTIFIED SOLUTION
phoffric

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
naseeam

ASKER
As expert said, problem solved.  I agree.

Bash shell might be topic in future.

Thank you to all experts.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.