begin process at 2010 02 10 10:46:33
  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 Problème d'affichage dans une fenêtre hEdit [ par piroman14 ] Bonjour je suis débutant avec les winAPI.Je n'arrive pas à afficher mon message dans la fenêtre hEditJ'y suis arrivé par hasard en mettant un MessageB if(ligne.substr(pos1+1,pos2-pos1-1)==A) !! [ par yanlou ] saluthil ne retourn que deux caractére "D" ou "A"ma question c'est comment je peux fair une boucle :if{}else{} Convertir VB6 en C++ [ par Tybbow ] Bonjour, j'aimerais convertir un code créé en VB6 vers le C++, malheureusement, je n'y connais rien en C++, j'ai essayé de trouver des logiciels, mais Héritage multiple et destructeur ==> Erreur de segmentation ?? [ par Rouliann ] Bonjour à tous.Voilà, j'ai une classe abstraite A :class A{    private:        string m_name;    public:        A() {m_name = "default_name";}        Base de registre [ par tribord10 ] Bonjour, j'ai vu se code sur le site:#include #include "resource.h" HWND hE déconnexion ou erreur de programmation ? [ par majong ] Bonjour, lorsque j'effectue ces deux requetes, le log me dit que la première est ok mais la 2° à échoué (requete echou 2).J'appelle la même requete po port serie sous linux rts txd drt source piklab [ par zemil ] je sui sous linux depuis peux je program avec kdevelope en c++ par hazard j'ais trouvé un logiciel qui arive a faire se que je recherche jé ais donc r


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
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 : 1,108 sec (4)

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