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, 1193👍, 0💬
Popular Posts:
How To Merge Cells in a Row? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells If you wan...
What are the core functionalities in XML .NET framework? Can you explain in detail those functionali...
How To Create an Add-to-Google-Reader Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS ...
Can you explain steps in function points? Below are the steps in function points: >First Count ILF, ...
Can each Java object keep track of all the threads that want to exclusively access to it?