begin process at 2012 02 12 03:30:44
  Trouver un code source :
 
dans
 
Accueil > Forum > 

C++ & C++ .NET

 > 

Windows

 > 

Autre

 > 

Erreur de compilation


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Erreur de compilation

lundi 11 août 2008 à 12:57:42 | Erreur de compilation

anouar27

Bjr,

Je fais de la programmation sur la Personnalisation d'un logiciel Pro/Engineer pour des clients.
J'ai eu un prblm de compilation, ça retourne les erreurs suivantes:
- error C2059:syntax error : 'type'
- NMAKE : fatal error U1077: 'cl' : return code '0x2'

voila le code source:j'ai marqué en rouge la ligne où il y à l'erreur dans le code.
###########################################################################
/*--------------------------------------------------------------------*\
Pro/TOOLKIT includes
\*--------------------------------------------------------------------*/
#include "ProToolkit.h"
#include "ProArray.h"

/*--------------------------------------------------------------------*\
C System includes
\*--------------------------------------------------------------------*/
#include <time.h>
#include <string.h>
#include <stdlib.h>

/*--------------------------------------------------------------------*\
Application includes
\*--------------------------------------------------------------------*/
#include "TestError.h"

/*--------------------------------------------------------------------*\
Application macros
\*--------------------------------------------------------------------*/
#define MAX_STAT_SIZE 38
/*--------------------------------------------------------------------*\
Application data types
\*--------------------------------------------------------------------*/
typedef struct
{
    int num;
    ProError status;
    char call[MAX_STAT_SIZE];
}TestStatistic;

typedef struct
{
    char     function_name[40];
    ProError permited_err_code;
} PermitedErrors;
   

/*--------------------------------------------------------------------*\
Application global/external data
\*--------------------------------------------------------------------*/
static FILE *errlog_fp=NULL;
static char errlog_name[PRO_PATH_SIZE]={'\0'};
TestStatistic *statistic = NULL;
char    trail_name[PRO_PATH_SIZE] = ""; /* The name of currently running
                       trail file */

static PermitedErrors permited_errors[] = {
    {"ProMenuProcess", PRO_TK_E_FOUND},
    {"ProModelitemNameGet", PRO_TK_E_NOT_FOUND},
    {"ProSelect", PRO_TK_PICK_ABOVE},
    {"ProSelect", PRO_TK_USER_ABORT},
    {"ProSolidDisplay", PRO_TK_E_FOUND},
    {"ProGraphicsColorSet", PRO_TK_NO_CHANGE},
    {"ProLinestyleSet", PRO_TK_NO_CHANGE}
};



/*====================================================================*\
  Function : ProTestStatisticCmp()
  Purpose  : compare two files by version
\*====================================================================*/
int ProTestStatisticCmp(TestStatistic *st1, TestStatistic *st2)
{
    int call_result;
    call_result = strncmp (st1->call, st2->call, MAX_STAT_SIZE);
    if (call_result == 0)
    {
        call_result = st1->status - st2->status;
    }
    return (call_result);
}

/*====================================================================*\
    FUNCTION :    ProTestStatisticWrite()
    PURPOSE  :    Write the specified params to the statistic file.
\*====================================================================*/
int ProTestStatisticWrite (char *call, char *from, ProError status)
{
    int i, line_num, line_found = 0;
    TestStatistic line;

    ProArraySizeGet ((ProArray)statistic, &line_num);
    if (errlog_fp == NULL)
    return (0);

    for (i = 0; i < line_num; i++)
    {
        if (strncmp (statistic[i].call, call, MAX_STAT_SIZE)==0)
        {
            if (statistic[i].status == status)
            {
                statistic[i].num++;
                line_found = 1;
                break;
            }
        }
    }
    if (!line_found)
    {
        strncpy (line.call, call, MAX_STAT_SIZE);
        if (strlen (call) >= MAX_STAT_SIZE)
        {
            line.call[MAX_STAT_SIZE-4] = '\0';
            strcat (line.call, "..");
        }
        line.status = status;
        line.num = 1;
        ProArrayObjectAdd ((ProArray*)&statistic, PRO_VALUE_UNUSED,
            1, &line);
        if (line_num > 1)
        {
            qsort(statistic, line_num+1, sizeof(TestStatistic),
                int *(PRO_CONST_ARG void *, PRO_CONST_ARG void *),   // C'est la ou j'ai l'erreur C2059
              ProTestStatisticCmp);
        }
    }
    return (1);
}

/*====================================================================*\
    FUNCTION : TEST_CALL_REPORT
    PURPOSE  : report a Pro/TOOLKIT function call, and status,
                        if status expression false

    call   = name of Pro/TOOLKIT function
    from   = name of function calling the Pro/Toolkit function
    status = status returned by Pro/Toolkit function
    error  =  BOOLEAN expression whether status is reportable
\*====================================================================*/
void ProTestCallReport(char *call, char *from, ProError status,int error)   
{                                                      
    int i, mode;                                          
    char str[100], *p_ch, line[100];

    if (error)
    {
    strcpy(line, call);
    p_ch =  strchr(line, '(');
    if (p_ch != NULL)
       *p_ch = '\0';
        for (i=0; i<sizeof(permited_errors)/sizeof(permited_errors[0]); i++)
        {
            if ((status == permited_errors[i].permited_err_code) &&
                (strcmp(permited_errors[i].function_name, line) == 0))
                error = 0;
        }
    }
   
    mode = ProTestRunmodeGet();
    switch (mode)
    {
    case  TEST_RUN_MODE_STAT:      
        ProTestStatisticWrite (call, from, status);
        break;
    case TEST_RUN_MODE_CRASH:
    case TEST_RUN_MODE_REPORT:
    sprintf(str,"%-37s %-37.37s% -d\n", call, from, status);
    ProTestErrlogWrite(str);
        if(mode == TEST_RUN_MODE_CRASH && error)           
        {                                                  
            printf("\n*** CRASHING Pro/TOOLKIT TEST ***\n");
            printf("    Function         : %s\n", call);   
            printf("    Calling function : %s\n", from);   
            printf("    Status           : %d\n", status); 
            TEST_CRASH()                                   
        }
        break;
    case TEST_RUN_MODE_CRASH_REP:
        if (error)
        {
            /* Report only potential crashes in crash mode*/
        sprintf(str,"%-37s %-37.37s% -d\n", call, from, status);
        ProTestErrlogWrite(str);
        }
    }                                                 
}


/*====================================================================*\
    FUNCTION :    ProTestErrlogOpen()
    PURPOSE  :    Open the Error Log file
\*====================================================================*/
int ProTestErrlogOpen(
    char *regtest_name,    /* Reg test name */
    char *proe_vsn,    /* Pro/E version */
    char *build)    /* Pro/E build   */
{
    int runmode, path_size;
    char *dot, *p_env, log_dir[PRO_PATH_SIZE];
    time_t t;
    char *default_regtest_name = "regtest";
    ProError status;

/*--------------------------------------------------------------------*\
    Don't open it if the run mode is "silent"
\*--------------------------------------------------------------------*/
    runmode = ProTestRunmodeGet();
    if(runmode == TEST_RUN_MODE_SILENT)
    return(0);

/*--------------------------------------------------------------------*\
    Find the directory in which to put the logfile
\*--------------------------------------------------------------------*/
    p_env = getenv("PROTOOL_LOG_DIR");

    if ( p_env == NULL )
    log_dir[0] = '\0';
    else
    {
    strcpy(log_dir, p_env);
    path_size = strlen(log_dir);
    if ( log_dir[path_size - 1] != '/')
    {
        log_dir[path_size] = '/';
        log_dir[path_size + 1] = '\0';
    }
    }
    printf("   Logfile dir : %s\n", log_dir);   
/*--------------------------------------------------------------------*\
    Make the name "<regtest>.log" and open the file for write.
\*--------------------------------------------------------------------*/
    if( regtest_name == NULL )
    regtest_name = default_regtest_name;

    dot = strchr(regtest_name, '.');
    if(dot != NULL)
    *dot = '\0';
    strcpy(errlog_name, regtest_name);
    strcat(errlog_name, ".log");
    strcat(log_dir, errlog_name);
    strcpy(errlog_name, log_dir);
    errlog_fp = fopen(errlog_name,"a");

/*--------------------------------------------------------------------*\
    Write a header
\*--------------------------------------------------------------------*/
    t = time(NULL);
    fprintf(errlog_fp, "# Pro/TOOLKIT Regression Test Log\n");
    fflush(errlog_fp);
    fprintf(errlog_fp, "#--------------------------------\n");
    fflush(errlog_fp);
    fprintf(errlog_fp, "# Pro/ENGINEER version : %s\n", proe_vsn);
    fflush(errlog_fp);
    fprintf(errlog_fp, "# Pro/ENGINEER build   : %s\n", build);
    fflush(errlog_fp);
    fprintf(errlog_fp, "# Started at           : %s", ctime(&t));
    fflush(errlog_fp);
    if( strlen( trail_name ) )
    {
    fprintf(errlog_fp, "# Trail file name      : %s\n", trail_name );
    fflush(errlog_fp);
    }
    fprintf(errlog_fp, "#\n" );
    fflush(errlog_fp);
    fprintf(errlog_fp,
"# Pro/TOOLKIT Function         Called From                   Status\n#\n");
    fflush(errlog_fp);

    if (runmode == TEST_RUN_MODE_STAT)
    {
        if (statistic == NULL)
        {
            status = ProArrayAlloc (0, sizeof (TestStatistic),
                10, (ProArray*)&statistic);
        }
    }
    return(0);
}
/*====================================================================*\
    FUNCTION :    ProTestErrlogReopen()
    PURPOSE  :    To reopen an ongoing error log file
\*====================================================================*/
int ProTestErrlogReopen()
{
    if( (int) strlen(errlog_name) > 0)
    errlog_fp = fopen(errlog_name,"a");
    return(0);
}

/*====================================================================*\
    FUNCTION :    ProTestErrlogClose()
    PURPOSE  :    Flush and close the error log file.
\*====================================================================*/
int ProTestErrlogClose()
{
    int num, i;
        if(errlog_fp != NULL)
    {
        if (statistic != NULL)
        {
            ProArraySizeGet ((ProArray)statistic, &num);
            for (i = 0; i < num; i++)
            {
                fprintf (errlog_fp, "%-37s% -20s% -6d% -6d\n",
                    statistic[i].call,
                    "internal()",
                    statistic[i].status,
                    statistic[i].num);
            }
            ProArrayFree ((ProArray*)&statistic);
        } 
    fflush(errlog_fp);
    fclose(errlog_fp);
    errlog_fp = NULL;
    }
    return(0);
}
/*====================================================================*\
    FUNCTION :    ProTestErrlogWrite()
    PURPOSE  :    Write the specified string to the error log file.
\*====================================================================*/
int ProTestErrlogWrite(
    char *str)
{
    if(errlog_fp == NULL)
    return(0);

    fprintf(errlog_fp, "%s", str);
    fflush(errlog_fp);
    ProTestErrlogClose();
    ProTestErrlogReopen();
    return(0);
}
/*====================================================================*\
    FUNCTION :  ProUtilCommandLineParse()
    PURPOSE  :  Parse the specified command line setting global params
\*====================================================================*/
int ProUtilCommandLineParse( int argc, char *argv[] )
{
    char        *p;
    int            i;
    for( i=1; i<argc; i++ )
    {
    if( strstr( argv[i], "+trail:" ) )
    {
        p = strchr( argv[i], ':' );
        strcpy( trail_name, p+1 );
    }
    }
    return PRO_TK_NO_ERROR;
}

###########################################################################
Merci d'avance, pour vos suggestions, je suis vraiment bloqué.

Anouar B.
lundi 11 août 2008 à 14:08:19 | Re : Erreur de compilation

SebLinck

Salut,
regarde la définition de la fonction qsort();
http://mapage.noos.fr/emdel/qsort.htm

Cordialement,
Sébastien.
lundi 11 août 2008 à 15:19:01 | Re : Erreur de compilation

zaibacker

Salut,

 

Je suis d'accord avec SebLink, le prototype de la fonction est :

void qsort (void *tableau             , size_t nb_elem             , size_t taille_elem             , int (*compare) (void const *a, void const *b)); 




Il prend 4 paramètres or toi tu en mets 5:


 qsort(statistic, line_num+1, sizeof(TestStatistic),
                int *(PRO_CONST_ARG void *, PRO_CONST_ARG void *),  
    ProTestStatisticCmp);




































































































lundi 11 août 2008 à 16:47:57 | Re : Erreur de compilation

anouar27

Salut,

Ouf, résolu
Merci bcp pour votre aide, résolu, grâce à vous.
Mille merci
Solution:
##############################################
qsort(statistic, line_num+1, sizeof(TestStatistic),
            (int (*)(PRO_CONST_ARG void *, PRO_CONST_ARG void *))
              ProTestStatisticCmp);
##############################################

Bien cordialement.
Anouar B.


Cette discussion est classée dans : name, pro, fp, if, errlog


Répondre à ce message

Sujets en rapport avec ce message

[code c++] hediteur hexa [ par devoX ] bonjours a tous,je suis debutant en c++ et je cherche a realiser un editeur hexadecimal sous Vc++J'ai deja commencer a ecririr une petite partie du co Problème d'affichage avec la fonction SetWindowText [ par piroman14 ] Hi everybody!!Quelqu'un pourrais-t-il m'expliquer pourquoi si SetWindowText(hEdit,"Traitement en cours..."); est avant   if (GetOpenFileName(&ofn)==TR Erreur à la lecture [ par deadbird ] hello ;) J'ai ici une fonction qui ouvre un fichier WAV, et le fread ne fonctionne pas, impossible de comprendre pourquoi...quelqu'un a une idée? [cod probleme de recuperation des noms des colonnes d'une table (mysql) [ par bouzazi ] Bonjour, j'ai une classe qui me permet de me connecté a une base de donnée mysql, la connexion marche très bien. lorsque je parcours le résultat avec segmentation fault openGL [ par livevlad ] Tout d'abord je met comme thème directX car avec OpenGL, se sont des library de base graphiques. Voici mon problème, je suis en train de suivre les t Aide pour un projet C [ par widad13 ] Bonsoir, j'ai un projet a faire; il s'agit d'ecrire un programme pour la gestion d'une biblioteque. j'ai trouvé une partie du code bien fait a vue d sensors en C++ wrapper ? [ par panthere007 ] Hello Je voudrai me bricoller un petit sof en console pour y afficher des alertes a ma sauce ,osd ,tty, son etc etc... man libsensors fourni bien de pbm code jock mfc [ par lamingrari12000 ] hi i have a big pblem i made a good progamme in c++ mfc in .net 2005 with Codejock Xtreme Toolkit Pro v11.20 the pblem is i ame using Codejock Xtreme problème chat [ par Adict ] salut tout le monde [^^happy17] alors j'ai commencé depuis peu à vouloir créer un "chat" simple. j'utilise donc les sockets qui marchent mais j'ai 2 besoin d'aide sur un programme en C éxécutable mais qui se bloque au début " recherche et affichage de palindromes " [ par nirvanitta ] salut tous le monde Mon programme consiste a ouvrir un fichier et chercher tous les palindromes et les afficher avec leurs numéros de lignes et leurs


Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 4,025 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales