Menu

Vista, Dev-c++, Djgpp only compiles sometime

safemill
2007-10-21
2012-09-26
  • safemill

    safemill - 2007-10-21

    Running Vista Business, and Dev-c++ with the djgpp compiler...

    This program will run...
    /******/

    include<stdio.h>

    void main(void)
    {
    while(1)
    printf("writing to screen- program is running, compiler working\n");
    }
    /*****/
    also...
    /
    *****/

    include<stdio.h>

    include<stdlib.h>

    void main(void)
    {
    printf("Hello world\n");
    system("pause");
    }
    /***** ... runs ***/

    but.................
    The following code gives an error, advising, 'The parameter is incorrect'. Most other programs I have tried are producing exactly this same result. This program is taken directly out of the Dev-c++ help files. Some other programs I've tried with this installation of djgpp/Dev-c++ also fail exactly this same way- after they were written on an XP machine with the same stuff a year ago, and when I tried them on this Vista installation it's one repetitive case of 'The parameter is incorrect'.
    /********/

    include <stdio.h>

    int main(int argc, char argv)
    {
    printf ("Press ENTER to continue.\n");
    getchar (); / wait for input */
    return 0;
    }
    /
    ******/
    For the program below, the compiler log reports...
    Compiler: Default compiler
    Executing gcc.exe...
    gcc.exe "C:\COLLEGE 3rd LEVEL\3rd Year\3315 Introduction to AI\Assignments\A1\Zsat1\JoeGarvey1.c" -o "C:\COLLEGE 3rd LEVEL\3rd Year\3315 Introduction to AI\Assignments\A1\Zsat1\JoeGarvey1.exe" -ansi -fmessage-length=0 -fmessage-length=0
    Execution terminated (it was another case of 'The parameter is incorrect')
    (saying there was 1 error. The code that generated that follows. It compiled OK on Ubuntu/Linux 3 days ago, and ran correctly. I include the code here just so if you feel you need to check it).
    /
    *******/
    /

    * NAME: Joe Garvey
    * NUMBER: 105758084
    * MODULE: CS3315 Introduction to AI
    THIS_IS: Assignment1
    * PROGRAM: JoeGarvey1.c
    * DUE: Nov 2007
    * NOTE:
    /
    /-=-=-=-=-=-=-=-=-=-=- I N C L U D E F I L E S =-=-=-=-=-=--=- /

    include<stdio.h>

    include<stdlib.h>

    / -=-=-=-=-=-=-= array declarations -=-=-=-=-=-=-=-=-=-=-=-=-- /

    int adjacent[6][6] = {
    /S F G A I S /
    /Spain / {0,1,0,0,0,0},
    /France / {0,0,1,0,1,1},
    /Germany /{0,0,0,1,0,1},
    /Austria /{0,0,0,0,1,1},
    /Italy / {0,0,0,0,0,1},
    /Switz / {0,0,0,0,0,0}
    };
    int cColors[6][4] = { / Country row sequence same as previous array /
    {1,2,3,4}, / COLORS ARE intended as Red, Yellow, Green Blue /
    {5,6,7,8},
    {9,10,11,12},
    {13,14,15,16},
    {17,18,19,20},
    {21,22,23,24}
    };

    /-=-=-=-=-=-=-=-=-=-=-=- F U N C T I O N S =-=-=-=-=-=-=-=-=-=-=-=-=-=- /
    int main(int argc,char argv[])
    {
    int C_count; /
    Country count index /
    int h_c_count; /
    horizontal country index /
    int v_c_count; /
    vertical country index /
    int colors; /
    number of colors allowed /
    FILE
    fp;
    if ((fp=fopen("satfile","w"))==NULL){
    printf("Cannot open 'satfile'.\n");
    exit(EXIT_FAILURE);
    }
    fprintf(fp,"p cnf 24 78\n"); / WRITE THE header /

                                     /* EVERY COUNTRY HAS AT LEAST 1 COLOR */
    

    for(C_count = 0; C_count < 6;C_count++){ / do each Country row /
    fprintf(fp,"%d %d %d %d 0\n", / writes every color(1..4) /
    cColors[C_count][0], / this OR /
    cColors[C_count][1], / this OR /
    cColors[C_count][2], / this OR /
    cColors[C_count][3]);/ this. /
    } / Should to here write 6 rows X 4 colors./

                             /* AT MOST ONLY ALLOW 1 COLOR TO EACH COUNTRY */
                                         /* The intervals of 1 color apart */
    

    for(C_count = 0; C_count<6 ;C_count++){/ each Country row. 6 iterations /
    for(colors =0; colors<3;colors++)
    {
    fprintf(fp,"-%d -%d 0\n",cColors[C_count][colors],cColors[C_count][colors+1]);
    }
    / The intervals of 2 colors apart /
    fprintf(fp,"-%d -%d 0\n",cColors[C_count][0],cColors[C_count][2]);
    fprintf(fp,"-%d -%d 0\n",cColors[C_count][1],cColors[C_count][3]);
    / The interval of 3 colors apart. /
    fprintf(fp,"-%d -%d 0\n",cColors[C_count][0],cColors[C_count][3]);
    }
    / This code produces from 9 adjacent Flags X 4 clauses (36 clauses) /
    / no 2 adjacent countries can have same color /
    for(v_c_count = 0; v_c_count<6; v_c_count++){ / each ROW of adjacent[][] /
    for(h_c_count = 0; h_c_count<6;h_c_count++) { /COLUMN of adjacent[][]/
    if(adjacent[v_c_count][h_c_count]) / flag set in adjacent[][]? /
    for(colors = 0;colors<4;colors++) / same condition each color/
    fprintf(fp,"-%d -%d 0\n",cColors[v_c_count][colors],cColors[h_c_count][colors]);
    }
    }
    fclose(fp);
    exit(EXIT_SUCCESS);
    }
    /-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= END OF FILE JoeGarvey1.c /

     
    • Osito

      Osito - 2007-10-21

      Spaces in path maybe?

       
    • Anonymous

      Anonymous - 2007-10-21

      When I compile the code it merely gives a warning about argc and argv not being used (so you may as well remove them).

      I would not necessarily trust anything in the Dev-C++ help file, it has been updated even less recently that Dev-C++ itself, and has always been seriously flawed.

      You are doing a number of thinks that require some consideration:

      1) Using Vista. Dev-C++ has some known issues with Vista (and possibly some unknown ones), See the "PLEASE READ BEFORE POSTING A QUESTION" thread for details and work arounds.

      2) Using spaces in paths. The thread mentioned in (1) also has something to say about that. Don't do it! This is almost certainly your problem.

      3) Using DJPP. There are few reasons to use a compiler other than the default MinGW/GCC tool-chain, much less an MS-DOS version of GCC. I thought DOS support had been dropped for Vista, but I am thinking of 64 bit versions. Nonetheless, no doubt 64bit will one day be the only version and your DJPP built code may no longer work.

      4) When you post a log, POST ALL OF IT! Just saying "(it was another case of 'The parameter is incorrect')" is not very helpful - why would you not just copy&paste it straight in!?

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.