In article <11*********************@h48g2000cwc.googlegroups. com>,
<Vi*******@gmail.comwrote:
>I am given source codes written using C. The writer told me that he
wrote on Linux. Now I am trying to compile and run it on Windows. There
are many errors shown up. Are there any configurations or any chances
in the source codes I need to get done before compiling it on Windows?
You are likely encountering a combination of several different
*kinds* of errors:
- the author may have written assuming the C95 or C99 standard, but
your Windows compiler likely does not support anything past C89
- the author may have used nonstandard extensions to the C language
itself that were supported on his compiler but are not supported
on yours
- the author may have assumed that an 'int' or a 'long' were
particular sizes different than what your compiler uses; this
can lead to some obvious compilation problems, but can also lead to
some difficult to find bugs
- the author very likely used linux (or more generally, Unix or POSIX)
operating system or library calls (and their associated header files)
to do things that are either done completely differently on Windows
or else are not possible at all on Windows
For the first three kinds of errors, you have a chance that, if you
plug away at the problem long enough, that you could rewrite the
code to conform to accepted portable C standards.
However, if system specific extensions were used, then possibly the
only way to implement those extensions would be to rewrite Windows
itself (or at the very least to write some new Windows device driver.)
We would have to have a look at the code in order to determine
the feasibility of making it work in Windows. (Don't post it!
At -most- post a URL of where we might find it.)
If you are fortunate, then possibly all you need to do is build
the source under MinGW; see
www.mingw.org for more information about that.
In this newsgroup, we can help to try to find fully standard ways of
writing specific reasonably-small bits of code (if we can figure out
what the author meant by them), but the people in this newsgroup
often do not know the little fiddly details about Windows or about Linux,
and we are qualified (or interested) here in taking something system-
specific about one operating system and indicating what the
corresponding system-specific bit is for a different operating system.
We're the *portable* code department here -- portable in the sense
of assuming that *only* what is in the C standard is available;
for anything that is Linux or Windows specific, we refer people to
other newsgroups.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest