Solved

MinGW   gcc -c  no such file or directory

Posted on 2013-05-11
19
785 Views
Last Modified: 2013-05-15
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
0
Comment
Question by:sai4
  • 7
  • 5
  • 3
  • +2
19 Comments
 

Author Comment

by:sai4
ID: 39159057
I thought I should also add that   gcc.exe is located in  C:\MinGW\bin\gcc


thanks

Steve
0
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 120 total points
ID: 39159062
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
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 60 total points
ID: 39159172
Type gcc --help to see the options.  I think you need to add '-o output.exe' to get an output file.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 60 total points
ID: 39159174
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
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 39159655
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
 

Author Comment

by:sai4
ID: 39159800
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
 

Author Comment

by:sai4
ID: 39159816
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
 

Author Comment

by:sai4
ID: 39159824
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
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 120 total points
ID: 39159829
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 60 total points
ID: 39159843
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
 

Author Comment

by:sai4
ID: 39159845
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
 
LVL 86

Assisted Solution

by:jkr
jkr earned 300 total points
ID: 39159849
Can you post the code that causes the error?
0
 

Author Comment

by:sai4
ID: 39159850
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
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 120 total points
ID: 39159851
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
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 120 total points
ID: 39159854
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
 
LVL 32

Assisted Solution

by:sarabande
sarabande earned 20 total points
ID: 39161096
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
 

Author Comment

by:sai4
ID: 39162608
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
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 120 total points
ID: 39162976
>> 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
 
LVL 32

Expert Comment

by:sarabande
ID: 39167699
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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now