Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Wy compiler is rejecting the simplest possible test programs ...
My compiler is rejecting the simplest possible test programs, with all kinds of syntax errors. It's complaining about the first line of
main(int argc, char **argv)
{
return 0;
}
✍: Guest
Perhaps it is a pre-ANSI compiler, unable to accept function prototypes and the like.
If you don't have access to an ANSI compiler, and you need to convert some newer code (such as that in this list) so that you can compile it, perform these steps:
1. Remove the argument type information from function prototype declarations, and convert prototype-style function definitions to old style. The new-style declarations
extern int f1(void);
extern int f2(int);
int main(int argc, char **argv) { ... }
int f3(void) { ... }
would be rewritten as
extern int f1();
extern int f2();
int main(argc, argv) int argc; char **argv; { ... }
int f3() { ... }
2. Replace void * with char * .
3. Perhaps insert explicit casts where converting between ``generic'' pointers (void *, which you've just replaced with char *) and other pointer types (for instance in calls to malloc and free, and in qsort comparison functions;
4. Insert casts when passing the ``wrong'' numeric types as function arguments, e.g. sqrt((double)i);.
5. Rework calls to realloc that use NULL or 0 as first or second arguments
6. Remove const and volatile qualifiers.
7. Modify any initialized automatic aggregates
8. Use older library functions
9. Re-work any preprocessor macros involving # or ##
10. Rework conditional compilation involving #elif.
11. Convert from the facilities of <stdarg.h> to <varargs.h>
12. Cross your fingers. (In other words, the steps listed here are not always sufficient; more complicated changes may be required which aren't covered by any cookbook conversions.)
It is possible to make many of these changes with the preprocessor rather than by editing source code.
2015-12-02, 1242👍, 0💬
Popular Posts:
What are shared (VB.NET)/Static(C#) variables? Static/Shared classes are used when a class provides ...
What is the purpose of Replication ? Replication is way of keeping data synchronized in multiple dat...
Can you tell me how to check whether a linked list is circular? Create two pointers, and set both to...
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written...
When should the register modifier be used? Does it really help? The register modifier hints to the c...