Lisa Crozier
2006-05-02 16:24:06 UTC
Hello! This is a very basic question but I am extremely desperate for help.
I am very new not only to MinGW but to programming in general. I am using
the package download MinGW-3.1.0-1, which has gcc-3.4.2-20040916-1, on
Windows XP, with GNU's Emacs for windows as my text editor.
I am trying to get drand48() to work, and I found a thread on this page with
instructions (copied below). I got as far as downloading all the files, but
can't a) compile them manually without changing the code or b) compile with
the Makefile given. And c) even if I could compile them, I suspect they
might not go into the right directory. I'll describe these problems one at a
time.
a) Compiling them manually gives me lots of declaration and parse
error messages (listed below). Are these really mistakes in the code, or am
I missing something?
b) This turns out to be more general problem with make. When I type
'make', even for a more basic example of hello world, I get the error
message "'make' is not recognized as an internal or external command,
operable program or batch file. Compilation exited abnormally with code 1 at
Mon May 01 15:27:05." This isn't an Emacs problem, because it also happens
from the command line. Can anyone point me to instructions on how to get
make to work?
c) Should I put these files straight into the "include" subdirectory
in my MinGW directory, or can they be contained within several layers of
subfolders (which is how they downloaded automatically)?
And finally, although this may be the wrong place to ask this question, I
would also love to know how to get Emacs to find my compiler (g++) without
the files I'm working on having to be in the raw compiler directory. Would
Makefiles solve this problem, if I could get them to work?
Many thanks to anyone who can help!!!
Lisa
Previous thread:
Hello!
contains a directory called libc/). This is a GPL library. Read the
license and see if it fits your needs. If .TRUE., download NEWLIB and
use the following procedure to obtain the functions you need.
1. Compile your program
2. Search on the newlib source tree the "missing links"
3. Add the necesary source files to your newlib-subset tree
4. GOTO 1 :-)
Here is what is necesary to obtain a library with some random functions
not defined in MSVCRT (I used this library to port some linux programs
to Win32):
Files you need:
./include/machine/ieeefp.h
./include/machine/types.h
./include/sys/_types.h
./include/sys/config.h
./include/sys/reent.h
./include/_ansi.h
./include/alloca.h
./include/math.h
./include/rand48.h
./include/reent.h
./include/stdlib.h
./src/erand48.c
./src/impure.c
./src/lrand48.c
./src/rand48.c
./src/srand48.c
./Makefile /* see below */
CC = gcc
INCLUDE = -I./include
CFLAGS = -s -O2 -mpentiumpro -Wall -W $(INCLUDE)
SRC = lrand48 erand48 srand48 rand48 impure
SRC := $(addprefix src/,$(addsuffix .c, $(SRC)))
OBJ := $(SRC:.c=.o)
all: libnewlib.a
libnewlib.a: $(OBJ)
_lrand48_r
lrand48
_srand48_r
srand48
__dorand48
_impure_ptr
_erand48_r
erand48
drand48() and erf() are on NEWLIB too. Copy the necesary files to the
newlib-subset source tree, add the basename of the file to the
Makefile"s SRC variable and give it a try.
Hope it helps!
Francisco
------------------
Compiling Error Messages:
g++ lrand48.c erand48.c srand48.c drand48.c rand48.c impure.c -o libnewlib
In file included from lrand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
lrand48.c:17: `_lrand48_r' was not declared in this scope
lrand48.c:17: `r' was not declared in this scope
lrand48.c:18: parse error before `*' token
lrand48.c: In function `long int _DEFUN(...)':
lrand48.c:20: `r' undeclared (first use this function)
lrand48.c:20: (Each undeclared identifier is reported only once for each
function it appears in.)
lrand48.c:20: `__dorand48' undeclared (first use this function)
lrand48.c: At global scope:
lrand48.c:27: `lrand48' was not declared in this scope
lrand48.c:28: syntax error before `{' token
In file included from erand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
erand48.c:17: `_erand48_r' was not declared in this scope
erand48.c:17: `r' was not declared in this scope
erand48.c:17: `xseed' was not declared in this scope
erand48.c:18: parse error before `*' token
erand48.c: In function `double _DEFUN(...)':
erand48.c:21: `r' undeclared (first use this function)
erand48.c:21: (Each undeclared identifier is reported only once for each
function it appears in.)
erand48.c:21: `xseed' undeclared (first use this function)
erand48.c:21: `__dorand48' undeclared (first use this function)
erand48.c: At global scope:
erand48.c:29: `erand48' was not declared in this scope
erand48.c:30: parse error before `short'
erand48.c: In function `double _DEFUN(...)':
erand48.c:31: redefinition of `double _DEFUN(...)'
erand48.c:20: `double _DEFUN(...)' previously defined here
erand48.c:31: redefinition of `double _DEFUN(...)'
erand48.c:20: `double _DEFUN(...)' previously defined here
erand48.c:32: `_REENT' undeclared (first use this function)
erand48.c:32: `_erand48_r' undeclared (first use this function)
In file included from srand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
srand48.c:17: `_srand48_r' was not declared in this scope
srand48.c:17: `r' was not declared in this scope
srand48.c:17: `seed' was not declared in this scope
srand48.c:18: parse error before `*' token
srand48.c:22: parse error before `->' token
srand48.c:23: parse error before `->' token
srand48.c:24: parse error before `->' token
srand48.c:25: parse error before `->' token
srand48.c:26: parse error before `->' token
srand48.c:27: parse error before `->' token
srand48.c:32: `srand48' was not declared in this scope
srand48.c:32: `seed' was not declared in this scope
srand48.c:33: parse error before `)' token
In file included from drand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
drand48.c:17: `_drand48_r' was not declared in this scope
drand48.c:17: `r' was not declared in this scope
drand48.c:18: parse error before `*' token
drand48.c: In function `double _DEFUN(...)':
drand48.c:20: `r' undeclared (first use this function)
drand48.c:20: (Each undeclared identifier is reported only once for each
function it appears in.)
drand48.c:20: `_erand48_r' undeclared (first use this function)
drand48.c: At global scope:
drand48.c:25: `drand48' was not declared in this scope
drand48.c:26: syntax error before `{' token
In file included from rand48.c:156:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
rand48.c:159: `__dorand48' was not declared in this scope
rand48.c:159: `r' was not declared in this scope
rand48.c:159: `xseed' was not declared in this scope
rand48.c:160: parse error before `*' token
rand48.c: In function `void _DEFUN(...)':
rand48.c:166: `r' undeclared (first use this function)
rand48.c:166: (Each undeclared identifier is reported only once for each
function it appears in.)
rand48.c:166: `xseed' undeclared (first use this function)
g++: impure.c: No such file or directory
Compilation exited abnormally with code 1 at Mon May 01 16:31:14
I am very new not only to MinGW but to programming in general. I am using
the package download MinGW-3.1.0-1, which has gcc-3.4.2-20040916-1, on
Windows XP, with GNU's Emacs for windows as my text editor.
I am trying to get drand48() to work, and I found a thread on this page with
instructions (copied below). I got as far as downloading all the files, but
can't a) compile them manually without changing the code or b) compile with
the Makefile given. And c) even if I could compile them, I suspect they
might not go into the right directory. I'll describe these problems one at a
time.
a) Compiling them manually gives me lots of declaration and parse
error messages (listed below). Are these really mistakes in the code, or am
I missing something?
b) This turns out to be more general problem with make. When I type
'make', even for a more basic example of hello world, I get the error
message "'make' is not recognized as an internal or external command,
operable program or batch file. Compilation exited abnormally with code 1 at
Mon May 01 15:27:05." This isn't an Emacs problem, because it also happens
from the command line. Can anyone point me to instructions on how to get
make to work?
c) Should I put these files straight into the "include" subdirectory
in my MinGW directory, or can they be contained within several layers of
subfolders (which is how they downloaded automatically)?
And finally, although this may be the wrong place to ask this question, I
would also love to know how to get Emacs to find my compiler (g++) without
the files I'm working on having to be in the raw compiler directory. Would
Makefiles solve this problem, if I could get them to work?
Many thanks to anyone who can help!!!
Lisa
Previous thread:
Hello!
Subject: [Mingw-users] Newbie question -- Random Function? erf
function?
Just trying to migrate a chunk of C code from Irix cc to MinGW -- I
have been using drand48 and erf to get random numbers and error
function but I can't find these in the libraries. Should I start
typing code copied from Numerical Recipes (in C) , or is there a
particular library that I can obtain and use for these functions?
maybe even a better one :-? Thanks.
Robert
As "g" said, glibc contains these functions. They are on NEWLIB too (itfunction?
Just trying to migrate a chunk of C code from Irix cc to MinGW -- I
have been using drand48 and erf to get random numbers and error
function but I can't find these in the libraries. Should I start
typing code copied from Numerical Recipes (in C) , or is there a
particular library that I can obtain and use for these functions?
maybe even a better one :-? Thanks.
Robert
contains a directory called libc/). This is a GPL library. Read the
license and see if it fits your needs. If .TRUE., download NEWLIB and
use the following procedure to obtain the functions you need.
1. Compile your program
2. Search on the newlib source tree the "missing links"
3. Add the necesary source files to your newlib-subset tree
4. GOTO 1 :-)
Here is what is necesary to obtain a library with some random functions
not defined in MSVCRT (I used this library to port some linux programs
to Win32):
Files you need:
./include/machine/ieeefp.h
./include/machine/types.h
./include/sys/_types.h
./include/sys/config.h
./include/sys/reent.h
./include/_ansi.h
./include/alloca.h
./include/math.h
./include/rand48.h
./include/reent.h
./include/stdlib.h
./src/erand48.c
./src/impure.c
./src/lrand48.c
./src/rand48.c
./src/srand48.c
./Makefile /* see below */
BEGIN Makefile <<
INCLUDE = -I./include
CFLAGS = -s -O2 -mpentiumpro -Wall -W $(INCLUDE)
SRC = lrand48 erand48 srand48 rand48 impure
SRC := $(addprefix src/,$(addsuffix .c, $(SRC)))
OBJ := $(SRC:.c=.o)
all: libnewlib.a
libnewlib.a: $(OBJ)
END Makefile
BEGIN newlib.def <<
BEGIN newlib.def <<
lrand48
_srand48_r
srand48
__dorand48
_impure_ptr
_erand48_r
erand48
END newlib.def <<
newlib-subset source tree, add the basename of the file to the
Makefile"s SRC variable and give it a try.
Hope it helps!
Francisco
------------------
Compiling Error Messages:
g++ lrand48.c erand48.c srand48.c drand48.c rand48.c impure.c -o libnewlib
In file included from lrand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
lrand48.c:17: `_lrand48_r' was not declared in this scope
lrand48.c:17: `r' was not declared in this scope
lrand48.c:18: parse error before `*' token
lrand48.c: In function `long int _DEFUN(...)':
lrand48.c:20: `r' undeclared (first use this function)
lrand48.c:20: (Each undeclared identifier is reported only once for each
function it appears in.)
lrand48.c:20: `__dorand48' undeclared (first use this function)
lrand48.c: At global scope:
lrand48.c:27: `lrand48' was not declared in this scope
lrand48.c:28: syntax error before `{' token
In file included from erand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
erand48.c:17: `_erand48_r' was not declared in this scope
erand48.c:17: `r' was not declared in this scope
erand48.c:17: `xseed' was not declared in this scope
erand48.c:18: parse error before `*' token
erand48.c: In function `double _DEFUN(...)':
erand48.c:21: `r' undeclared (first use this function)
erand48.c:21: (Each undeclared identifier is reported only once for each
function it appears in.)
erand48.c:21: `xseed' undeclared (first use this function)
erand48.c:21: `__dorand48' undeclared (first use this function)
erand48.c: At global scope:
erand48.c:29: `erand48' was not declared in this scope
erand48.c:30: parse error before `short'
erand48.c: In function `double _DEFUN(...)':
erand48.c:31: redefinition of `double _DEFUN(...)'
erand48.c:20: `double _DEFUN(...)' previously defined here
erand48.c:31: redefinition of `double _DEFUN(...)'
erand48.c:20: `double _DEFUN(...)' previously defined here
erand48.c:32: `_REENT' undeclared (first use this function)
erand48.c:32: `_erand48_r' undeclared (first use this function)
In file included from srand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
srand48.c:17: `_srand48_r' was not declared in this scope
srand48.c:17: `r' was not declared in this scope
srand48.c:17: `seed' was not declared in this scope
srand48.c:18: parse error before `*' token
srand48.c:22: parse error before `->' token
srand48.c:23: parse error before `->' token
srand48.c:24: parse error before `->' token
srand48.c:25: parse error before `->' token
srand48.c:26: parse error before `->' token
srand48.c:27: parse error before `->' token
srand48.c:32: `srand48' was not declared in this scope
srand48.c:32: `seed' was not declared in this scope
srand48.c:33: parse error before `)' token
In file included from drand48.c:14:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
drand48.c:17: `_drand48_r' was not declared in this scope
drand48.c:17: `r' was not declared in this scope
drand48.c:18: parse error before `*' token
drand48.c: In function `double _DEFUN(...)':
drand48.c:20: `r' undeclared (first use this function)
drand48.c:20: (Each undeclared identifier is reported only once for each
function it appears in.)
drand48.c:20: `_erand48_r' undeclared (first use this function)
drand48.c: At global scope:
drand48.c:25: `drand48' was not declared in this scope
drand48.c:26: syntax error before `{' token
In file included from rand48.c:156:
rand48.h:20: `__dorand48' was not declared in this scope
rand48.h:20: parse error before `,' token
rand48.h:20: warning: `_EXFUN' initialized and declared `extern'
rand48.h:20: variable or field `_EXFUN' declared void
rand48.h:20: initializer list being treated as compound expression
rand48.c:159: `__dorand48' was not declared in this scope
rand48.c:159: `r' was not declared in this scope
rand48.c:159: `xseed' was not declared in this scope
rand48.c:160: parse error before `*' token
rand48.c: In function `void _DEFUN(...)':
rand48.c:166: `r' undeclared (first use this function)
rand48.c:166: (Each undeclared identifier is reported only once for each
function it appears in.)
rand48.c:166: `xseed' undeclared (first use this function)
g++: impure.c: No such file or directory
Compilation exited abnormally with code 1 at Mon May 01 16:31:14