GCC (Port from Linux to Win32)

E

eeh

Hi,

I am extremely new to write C programs by GCC. I need to port a C
program from GCC(Linux) to GCC(Win32). However, the following errors
during compilation:

powerSwitch.c `random' undeclared (first use this function)

Besides, I cannot find the online library help of GCC for WIN32? Could
anyone give me a web link?

Thanks!
 
R

Robert Gamble

eeh said:
Hi,

I am extremely new to write C programs by GCC. I need to port a C
program from GCC(Linux) to GCC(Win32). However, the following errors
during compilation:

powerSwitch.c `random' undeclared (first use this function)

random is not a Standard C function, it is a BSD extension and
therefore likely to not exist in the same form on Windows. You may
want to consider using the Standard rand function instead.
Besides, I cannot find the online library help of GCC for WIN32? Could
anyone give me a web link?

I see you are posting via Google Groups, I think they Google has some
sort of web search thingy too, might want to try that out.

Robert Gamble
 
C

Chuck F.

eeh said:
I am extremely new to write C programs by GCC. I need to port a
C program from GCC(Linux) to GCC(Win32). However, the following
errors during compilation:

powerSwitch.c `random' undeclared (first use this function)

If you have to specify a compiler and system you are off-topic
here, where we deal with the portable C language as defined by the
appropriate standards.

Your problem is that you are using a non-standard function. There
is no 'random' in C. However, 'rand' does exist.

For a way to simulate the usual functioning of random, see the
C-FAQ at <http://www.eskimo.com/~scs/C-faq/top.html> You should
have read this prior to posting here at any rate.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
I

iamgodk

ÓÚ Wed, 04 Jan 2006 21:53:14 -0800£¬eehдµ½£º
Hi,

I am extremely new to write C programs by GCC. I need to port a C
program from GCC(Linux) to GCC(Win32). However, the following errors
during compilation:

powerSwitch.c `random' undeclared (first use this function)

Besides, I cannot find the online library help of GCC for WIN32? Could
anyone give me a web link?

Thanks!
int rand();
 
C

Chuck F.

Keith said:
The C FAQ's new home is <http://c-faq.com>. It's also been
significantly updated recently (a Christmas present from Steve
Summit).

The copy I have here is marked last modified July 3, 2004. When
there were some announcements around Christmas I went and looked,
and I thought I found that the new version had the same date, so I
didn't download it. I guess I should look again.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
K

Keith Thompson

Chuck F. said:
The copy I have here is marked last modified July 3, 2004. When there
were some announcements around Christmas I went and looked, and I
thought I found that the new version had the same date, so I didn't
download it. I guess I should look again.

Before December 25, the web version of the FAQ hadn't been updated in
several years. It now appears to be up to date (and reformatted). I
haven't (yet) looked at the other versions, such as the text version.
 
M

Mark McIntyre

powerSwitch.c `random' undeclared (first use this function)

this is a nonstandard function, you should find it in one of the gcc
libs. "man random" may help.
Besides, I cannot find the online library help of GCC for WIN32? Could
anyone give me a web link?

gcc is multiplatform, if you have a win32 implementation with full
libs (such as the Cygwin one) you can simply rebuild and it'll work,
provided it doesn't use anything heavily dependent on the unix
filesystem or security model.

For further info, try a gcc group.
Mark McIntyre
 
S

Steve Summit

Keith said:
Before December 25, the web version of the FAQ hadn't been updated in
several years. It now appears to be up to date (and reformatted).

Here's the scoop:

Back when I did the book version, I expanded the base of material
about threefold. Some of the new book material also went back into
the plain-text Usenet version. Also, that was the birth of the
webified HTML version, which contained more or less the same text
as the Usenet version, with a few additions.

Since then, I've made various levels of corrections and additions
and improvements, although until recently I didn't manage to,
like, actually publicly *post* much of the new material or
anything. The Usenet version saw a few, sporadic, significant
improvements, but except for a couple of patches the web version
remained mired in its nineteen-ninety-I'm-embarrassed-to-say
state.

But, finally, as of July 2004 the Usenet version is up-to-date
with all the corrections and samples of new material I felt it
needed, and as of Christmas, the web version is up-to-date with
*everything*. (Well, everything contentwise, anyway; the HTML
formatting unfortunately still needs some work.) In particular,
the web version at http://c-faq.com now contains all the text
from the book, plus new material that doesn't even appear in the
book. So anywhere it still says "the book version contains 2-3
times as much material as the on-line versions" is now wrong.

Unfortunately, generating any of these versions from the master
manuscripts is never as trivial and automatic as it's supposed
to be. I need to run off a new version of the plain-text,
posted-to-Usenet version again, although the changes since
July '04 that would affect it are (so far) still slight.

Steve Summit
(e-mail address removed)

30484098515719505171054845301083113645927310171646573304967293037699688391982
 
C

CBFalconer

Steve said:
Here's the scoop:
.... snip ...

Unfortunately, generating any of these versions from the master
manuscripts is never as trivial and automatic as it's supposed
to be. I need to run off a new version of the plain-text,
posted-to-Usenet version again, although the changes since
July '04 that would affect it are (so far) still slight.

I keep the text version here for quick and easy offline access, so
all I am really interested in is when that is updated, and where is
it. It is actually fairly awkward to find from c-faq.com.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,937
Members
47,481
Latest member
ElviraDoug

Latest Threads

Top