MinGW gcc -c no such file or directory

I'm trying to compile a C programing in windows using MINGW

below is the command I'm using

c:\MinGW\bin\gcc –c  ddefit95.c ddeq.c w95dde.c matrix.c qp.c spline.c gcv.c rangen.c stochmin.c map.c cr.c

and the files listed are in the current directory.

However my output is "no such file or directory"

I then tried

c:\MinGW\bin\gcc –c  ddefit95.c

and


c:\MinGW\bin\gcc –c  DDEFIT95.c

but got the same output.  Any help would be greatly appreciated.

Thank you,

Steve
sai4Asked:
Who is Participating?
 
jkrCommented:
Check whether 'C:\MinGW\bin\gcc' is included in your PATH environment variable by typing

echo %PATH%

Open in new window


on the command prompt. If it isn't, add it by using

set PATH=%PATH%;C:\MinGW\bin\gcc

Open in new window


This should remedy this problem, yet you will also have to set LIBPATH and INCLUDE to their respective locations.
0
 
sai4Author Commented:
I thought I should also add that   gcc.exe is located in  C:\MinGW\bin\gcc


thanks

Steve
0
 
phoffricCommented:
Not a ming expert, but general question:
Did you get a Hello World two line program to work after you installed Ming? That is an important step to verify your installation is working.
Did the error message specify what file was not found?

Here is related trouble-shooting article:
http://www.mingw.org/wiki/Building_a_program_giving_me_error_messages
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Dave BaldwinFixer of ProblemsCommented:
Type gcc --help to see the options.  I think you need to add '-o output.exe' to get an output file.
0
 
Dave BaldwinFixer of ProblemsCommented:
Try doing it without the '-c'.  It should give you output in 'a.exe'.

c:\MinGW\bin\gcc ddefit95.c ddeq.c w95dde.c matrix.c qp.c spline.c gcv.c rangen.c stochmin.c map.c cr.c
0
 
sai4Author Commented:
Hi phoffric  thank you for your comment, I was able to compile a "hello world" program using the following steps


c:\MinGW\bin\gcc -c hello.cpp

c:\MinGw\bin\gcc -o hello.exe hello.o

which gives me a working  hello.exe program
0
 
sai4Author Commented:
Hi DaveBaldwin I tried c:\MinGW\bin\gcc hello.o  which gives a.exe as a working "hello world" program

when I tried that with my original problem I got

C:\ddefit>c:\MinGW\bin\gcc ddefit95.c ddeq.c w95dde.c matrix.c qp.c spline.c gcv
.c rangen.c stochmin.c map.c cr.c

results in the following:

ddefit95.c: In function 'G':
ddefit95.c:433:3: warning: passing argument 1 of 'Jacobian' from incompatible po
inter type [enabled by default]
ddefit95.c:133:6: note: expected 'int (*)(struct matrix,  struct matrix,  struct
 matrix,  struct matrix,  struct matrix,  void *, int,  double)' but argument is
 of type 'void (*)(struct matrix,  struct matrix,  struct matrix,  struct matrix
,  struct matrix,  void *, int,  double)'
ddefit95.c: In function 'getno':
ddefit95.c:661:20: warning: cast from pointer to integer of different size [-Wpo
inter-to-int-cast]
C:\Users\JIMSHA~1\AppData\Local\Temp\ccQl6gPm.o:w95dde.c:(.text+0x8a6): undefine
d reference to `CreatePen@12'
0
 
sai4Author Commented:
Hi jkr thank you  I corrected the path variable, and used   gcc in stead of c:\MinGw\bin\gcc but I still got the same error.
0
 
phoffricCommented:
I started writing a reply, but then I saw your new comment, but it does not contain the problem in your OP, namely "However my output is "no such file or directory".

It looks like you fixed your original problem (if so, how did you do that), and now you have compiler warnings.

More specifically, when you got your  "no such file or directory" compiler error, what file was listed as missing?
0
 
Dave BaldwinFixer of ProblemsCommented:
Good, that means that your compiler is working even if your program is not.  I think the original problem may have been that some kind of output file is needed for the compiled output.  Or it could have been a path problem.
0
 
sai4Author Commented:
Thank you phoffric,

The error was saying   that the missing file was "gcc -c " but no specific file was listed. I can't reproduce the error now. All I've done is change the path variable as was mentioned above.
0
 
jkrCommented:
Can you post the code that causes the error?
0
 
sai4Author Commented:
Thank you David phoffric and everyone for your responses. does this mean the problem is not with MinGW?  The code is maintained on a website and I do know it works though.
0
 
phoffricCommented:
In your latest listing, you did not show any compiler errors. Regarding your warning:
>>  'int (*)(struct matrix,  struct matrix,  struct matrix,  struct matrix,  struct matrix,  void *, int,  double)
>> 'void (*)(struct matrix,  struct matrix,  struct matrix,  struct matrix,  struct matrix,  void *, int,  double)'

You are passing in a function name that returns a void; but what is expected is one that returns an int.

>>  undefined reference to `CreatePen@12'
Here is a link that discusses this problem:
    http://cboard.cprogramming.com/cplusplus-programming/111464-compile-error-35-undefined-reference-%60_createpen%4012.html
0
 
phoffricCommented:
You got Hello World working which is a good start. And being able to get it to work with just gcc instead of the full gcc path is a better start. But as this link indicated, there could be other issues:
    http://www.mingw.org/wiki/Building_a_program_giving_me_error_messages 
Did you go through these points in this link and confirm that there is no problem?

Also, it is not clear whether you are linking correctly with all the proper libraries included. "undefined reference" are linker errors, not compiler errors. Did you get documentation on how to link this system?
0
 
sarabandeCommented:
set PATH=%PATH%;C:\MinGW\bin\gcc

if that is the path definition that solved the error 'no such file or directory', then the reason is clear. in the path of your original command, the folder 'gcc' was named and not the file 'gcc.exe'.

The code is maintained on a website and I do know it works though.
the code may compile with another (older) compiler. your compiler (coming with mingw) does not and you have to correct the errors. i wonder that there is no makefile coming with the sources. such a makefile could have added compiler and linker options which help to overcome the errors.

Sara
0
 
sai4Author Commented:
I should correct myself,

to set the path I used

set PATH=%PATH%;C:\MinGW\bin

Yeah it is weird that there is no makefile. I was under the impression though that make files weren't something used in windows?

Well it seems we're onto a different problem now though, MinGW is trying to compile just failing so I'll post the points and probably open up a new question once I figure out what to ask.

Thank you everyone for your responses.

Best,

Steve
0
 
phoffricCommented:
>> warning: cast from pointer to integer of different size

For this warning, please look at this description:
    http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fcommon%2Fm1rhcptr.html
0
 
sarabandeCommented:
actually any ide uses some kind of makefiles even if they were called differently or were based on xml. the main reason is simple: for any non-trivial project the number of files and options to handle are far too much as that you could pass them via commandline. moreover, by using a makefile or projectfile, you can do an incremental build, what means that you were building only those files that have changed or were dependent on changed files but not the whole project any time.  

Sara
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.