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, 1272👍, 0💬
Popular Posts:
What will be printed as the result of the operation below: main() { int x=20,y=35; x=y++ + x++; y= +...
In C#, what is a weak reference? Generally, when you talk about a reference to an object in .NET (an...
How To Download and install PSP Evaluation? - PSP Tutorials - Fading Images to Background Colors wit...
Example of using Regular Expressions for syntax checking in JavaScript ... var re = new RegExp("^(&a...
Have you ever worked with Microsoft Application Blocks, if yes then which? Application Blocks are C#...