Re: [Dev-C++] Dev-C++, MingW, and MSYS
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Luigi S. <gi...@li...> - 2002-05-30 04:37:04
|
At 12:02 28/05/02 -0500, Mac Reiter wrote:
>I downloaded the Beta3 installer and everything installed fine. I then
>made a trivial "Hello World" project and hit Rebuild All. I was informed
>that the required DLL MSYS-1.0.DLL was missing. After much fiddling
>around, I discovered that the rm.exe program (presumably from the new MingW
>set) is the offending program.
>...
>
Hi, Mac Reiter
I've followed your steps to reproduce the error using Dev-C++ beta3 on Win98SE;
I did not see anything concerning the DLL MSYS-1.0.DLL so can't help about
that thing, however, as in your case, there are problems with the execution
of the command "rm".
I think the problem is related to Dev-C++, in fact it assumes your system
implements the command "rm"; this is probably true for recent versions of
Windows (sorry can't check that), but is surely wrong for Win98SE and
previous versions (because the command implemented is "del").
As Colin Laplace says, you can download "rm" from the web.
My solution has been writing an elementary version of "rm" (I stored the
executable file "rm.exe", in the directory where MinGW binaries are) that
uses "del". In case you are interested, here is the code.
file: rm.cpp
-----------------------------------------------------------------------
#include <iostream>
#include <cstdlib>
#include <string>
/*********************************************************************
turn each slash ('/') in a backslash ('\\')
parameters:
s = the string with slashes
returns:
the string with backslashes
GNU "make" requires paths to be written using UNIX style (even if
here we are dealing with the Windows port of the program) while the
standard Windows command "del" requires paths to be written using the
DOS style (that is, using a backslash to delimit names of
directories).
*********************************************************************/
std::string
rev(const std::string& s);
/*********************************************************************
rm - remove a file
usage:
rm FILE [...]
arguments:
FILE = file to be deleted
... = more than one file can be specified
samples:
rm c:/foo/bar delete file c:\foo\bar
rm c:\foo\bar same as above
rm foo bar delete files: foo and bar
rm -f foo bar same as above, "-f" is ignored
This program is used in place of the Windows standard command "del"
for the following 2 reasons.
1. The standard command deletes one file at a time or more than one
file, only if the names are specified using wildcards. For instance
you can say: "del foo" or "del *.o" but you are not allowed to say
"del foo bar".
2. The standard command understands paths written using the DOS style
for paths, that is "foo\bar" and is unable to locate a file if one
writes "foo/bar".
*********************************************************************/
int
main(int argc, char** argv)
{
while (--argc && **++argv == '-')
;
if (argc == 0) // nothing to work on
std::cerr << "usage: rm FILE [...]\n";
else
{
std::cerr << "deleting ...";
while (argc--)
{
std::string file = rev(*argv++);
std::string cmd = "del " + file;
std::cerr << '\n' << file << ' ';
system(cmd.c_str());
}
std::cerr << "\ndone ...\n";
}
}
//////////////////////////////////////////////////////////////////////
std::string
rev(const std::string& s)
{
std::string p = s;
for (int i = 0; i < p.size(); i++)
if (p[i] == '/')
p[i] = '\\';
return p;
}
-----------------------------------------------------------------------
--
Luigi
gi...@li...
|