×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

@

Something wrong,Read it yourself:

本文发表在 rolia.net 枫下论坛root@mars larry]# gcc 1.cpp

1.cpp:1:20: stdafx.h: No such file or directory
1.cpp: In function `void write_symmetric_pair(char*, char*)':
1.cpp:26: error: `isalpha' undeclared (first use this function)
1.cpp:26: error: (Each undeclared identifier is reported only once for each function it appears in.)
1.cpp: In function `void write_symmetric_triple(char*, char*)':
1.cpp:58: error: `isalpha' undeclared (first use this function)
1.cpp:62: error: expected primary-expression before '[' token
1.cpp:62: error: stray '\207' in program
1.cpp:62: error: stray '\224' in program
1.cpp:62: error: stray '\212' in program
1.cpp:62: error: stray '\188' in program
1.cpp:62: error: stray '\188' in program
1.cpp:62: error: stray '\211' in program
1.cpp:62: error: stray '\196' in program
1.cpp:62: error: stray '\195' in program
1.cpp:62: error: stray '\180' in program
1.cpp:62: error: stray '\243' in program
1.cpp:62: error: expected primary-expression before ':' token
1.cpp:62: error: expected `]' before ':' token
1.cpp:62: error: expected `;' before ':' token
1.cpp:62: error: stray '\183' in program
1.cpp:62: error: stray '\227' in program
1.cpp:62: error: stray '\207' in program
1.cpp:62: error: stray '\194' in program
1.cpp:62: error: stray '\194' in program
1.cpp:62: error: stray '\219' in program
1.cpp:62: error: stray '\204' in program
1.cpp:62: error: stray '\179' in program
1.cpp: In function `int main(int, char**)':
1.cpp:123: error: `isdigit' undeclared (first use this function)
1.cpp:124: error: stray '\163' in program
1.cpp:124: error: stray '\188' in program
1.cpp:124: error: `r' undeclared (first use this function)
1.cpp:124: error: expected `;' before "o"
1.cpp:124: error: stray '\163' in program
1.cpp:124: error: stray '\190' in program
1.cpp:186: error: stray '\183' in program
1.cpp:186: error: stray '\227' in program
1.cpp:186: error: stray '\207' in program
1.cpp:186: error: stray '\194' in program
1.cpp:186: error: stray '\194' in program
1.cpp:186: error: stray '\219' in program
1.cpp:186: error: stray '\204' in program
1.cpp:186: error: stray '\179' in program
1.cpp:186: error: `www' undeclared (first use this function)
1.cpp:186: error: `forum' undeclared (first use this function)
1.cpp:186: error: expected `;' before '}' token更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 专业知识杂谈 / 谁能帮我把这个C CODE 转成能在LINUX 下运行的二进制文件?多谢!
    本文发表在 rolia.net 枫下论坛#include "stdafx.h"

    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <string.h>


    #define MAXIMAGES 300
    #define LINELENGTH 100

    #define TRUE 1
    #define FALSE 0


    void write_symmetric_pair(char *file_in, char *file_out)
    {
    FILE *fp1, *fp2;
    char line[300];
    float x1, y1, x2, y2;
    int length;

    printf("Pair in %s \nout %s\n", file_in, file_out);

    length = strlen(file_in);
    while (!isalpha(file_in[length]))
    file_in[length--] = 0;

    length = strlen(file_out);
    while (!isalpha(file_out[length]))
    file_out[length--] = 0;

    fp1 = fopen(file_in, "r");
    if (fp1 == NULL) {puts("Failed in"); return;}
    fp2 = fopen(file_out, "w");
    if (fp2 == NULL) {puts("Failed out"); return;}

    while (fgets(line, LINELENGTH, fp1)) {
    sscanf(line,"%f %f %f %f\n", &x1, &y1, &x2, &y2);
    fprintf(fp2, "%f %f %f %f\n", x2, y2, x1, y1);
    }
    fclose(fp1);
    fclose(fp2);

    }


    void write_symmetric_triple(char *file_in, char *file_out)
    {
    FILE *fp1, *fp2;
    char line[300];
    float x1, y1, x2, y2, x3, y3;
    int length;

    printf("Pair in %s \nout %s\n", file_in, file_out);

    length = strlen(file_in);
    while (!isalpha(file_in[length]))
    file_in[length--] = 0;

    length = strlen(file_out);
    while (!isalpha(file_out[length]))
    file_out[length--] = 0;

    fp1 = fopen(file_in, "r");
    if (fp1 == NULL) {puts("Failed in"); return;}
    fp2 = fopen(file_out, "w");
    if (fp2 == NULL) {puts("Failed out"); return;}

    while (fgets(line, LINELENGTH, fp1)) {
    sscanf(line, "%f %f %f %f %f %f\n", &x1, &y1, &x2, &y2, &x3, &y3);
    fprintf(fp2, "%f %f %f %f %f %f\n", x3, y3, x2, y2, x1, y1);
    }
    fclose(fp1);
    fclose(fp2);

    }



    main(int argc, char *argv[])

    {
    char line[LINELENGTH];
    char fname[300];
    char command_filename[300], postamble[300], ftype1[10], ftype2[10], ftype3[10], number[300], c;
    char preamble1[300], preamble2[300], preamble3[300], outstring[300];
    int number1, number2, number3;
    int index, i, j, k, l;
    FILE *fp1, *fp2;
    int lengthtwo = FALSE;

    int tempIndex;

    printf("Argc %d\n", argc);

    if (argc == 1) {
    puts("symmetric <file list>");
    exit(2);
    }

    printf("Argc %d\n", argc);
    /* get file list and optional args for the compFM */
    puts("Arg 1");
    puts(argv[1]); puts("\n");

    strcpy(fname, argv[1]);
    strcpy(command_filename, fname);

    fp1 = fopen(fname, "r");
    printf("Command filename %s\n", command_filename);

    while (fgets(line, LINELENGTH, fp1)) {
    lengthtwo = FALSE;
    printf("Filename %s\n", line);
    //sscanf(line, "[^-]%d.%s-%s-%d.%s.%s\n", preamble1, &number1, ftype1, preamble2, &number2, ftype2, postamble);
    //printf("Preamble1 %s number1 %d ftype1 %s preamble2 %s number2 %d ftype2 %s postamble %s\n",
    // preamble1, number1, ftype1, preamble2, number2, ftype2, postamble);
    /* get first sequence */
    index = 0;
    i = 0;
    while ((c = line[index++]) != '-' && c != 0 && c!='.') {
    if(!isdigit(c))
    preamble1[i++] = c;
    }
    preamble1[i++] = 0;
    printf("Preamble1 %s\n", preamble1);

    if (c == 0) {
    strcpy(postamble, preamble1);
    printf("postamble %s\n", postamble);
    } else {

    i = 0; index=0;
    while ((c = line[index++]) != '.' ){
    if(isdigit(c))
    number[i++] = c;
    }

    number[i] = 0;
    printf("Number %s\n", number);
    number1 = atoi(number);
    ftype1[0] = line[index++]; ftype1[1] = line[index++];
    ftype1[2] = line[index++]; ftype1[3] = 0;
    printf("File type 1 %s\n", ftype1);
    }

    line[index++];

    tempIndex=index; //Save the begining position of the second image file name

    i = 0;
    while ((c = line[index++]) != '-' && c != 0 && c!= '.') {
    if(!isdigit(c))
    preamble2[i++] = c;
    }
    preamble2[i++] = 0;
    printf("Preamble2 %s\n", preamble2);

    if (c == 0) {
    strcpy(postamble, preamble2);
    printf("postamble %s\n", postamble);
    } else {

    i = 0; index = tempIndex; //Restore the saved position
    while ((c = line[index++]) != '.'){
    if(isdigit(c))
    number[i++] = c;
    }


    number[i] = 0;
    printf("Number %s\n", number);
    number2 = atoi(number);
    ftype2[0] = line[index++]; ftype2[1] = line[index++];
    ftype2[2] = line[index++]; ftype2[3] = 0;
    printf("File type 2 %s\n", ftype2);
    printf("is left %s\n", &line[index]);
    if (line[index] == '-') index++;
    }

    //line[index++];


    tempIndex=index; //Save the begining position of the third image file name

    i = 0;
    while ((c = line[index++]) != '-' && c != 0 && c!='.' ) {
    if(!isdigit(c)) {
    preamble3[i++] = c;
    printf("Char %d\n", c);
    }
    }
    preamble3[i++] = 0;

    //if (preamble3[0]!=0) {
    lengthtwo = FALSE;
    printf("Preamble3 %s\n", preamble3);


    if (c == 0) {
    strcpy(postamble, preamble3);
    printf("postamble %s\n", postamble);
    lengthtwo = TRUE;
    } else {

    i = 0; index = tempIndex; //Restore the saved position
    while ((c = line[index++]) != '.') {
    if(isdigit(c))
    number[i++] = c;
    }


    number[i] = 0;
    printf("Number %s\n", number);
    number3 = atoi(number);
    ftype3[0] = line[index++]; ftype3[1] = line[index++];
    ftype3[2] = line[index++]; ftype3[3] = 0;
    printf("File type 3 %s\n", ftype3);
    }

    // }// End of " if (preamble3[0]!=0) { "


    if (lengthtwo) { //length = two, symmetricing FMmatches
    printf("Length two\n");
    printf("%s%d.%s-%s%d.%s%s\n",preamble2, number2, ftype2, preamble1, number1, ftype1, postamble);
    sprintf(outstring, "%s%d.%s-%s%d.%s%s\n",preamble2, number2, ftype2, preamble1, number1, ftype1, postamble);
    write_symmetric_pair(line, outstring);
    }
    else { //length != two , symmetricing TMmatches
    i = 0;
    while ((c = line[index++]) != '-' && c != 0) {
    postamble[i++] = c;
    }
    postamble[i++] = 0;
    printf("final Postamble3 %s\n", postamble);
    printf("Length three\n");
    printf("%s%d.%s-%s%d.%s-%s%d.%s%s\n",
    preamble3, number3, ftype3, preamble2, number2, ftype2, preamble1, number1, ftype1, postamble);
    sprintf(outstring, "%s%d.%s-%s%d.%s-%s%d.%s%s\n",
    preamble3, number3, ftype3, preamble2, number2, ftype2, preamble1, number1, ftype1, postamble);
    write_symmetric_triple(line, outstring);

    }
    }

    fclose(fp1);

    }更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • #include "stdafx.h" ???
      • oh, that was added automatically by .NET system. I don't need it anyway.
    • Get a Linux box with GCC, and try yourself.
      • how and where to get a linux box with GCC? 3x!
    • Something wrong,Read it yourself:
      本文发表在 rolia.net 枫下论坛root@mars larry]# gcc 1.cpp

      1.cpp:1:20: stdafx.h: No such file or directory
      1.cpp: In function `void write_symmetric_pair(char*, char*)':
      1.cpp:26: error: `isalpha' undeclared (first use this function)
      1.cpp:26: error: (Each undeclared identifier is reported only once for each function it appears in.)
      1.cpp: In function `void write_symmetric_triple(char*, char*)':
      1.cpp:58: error: `isalpha' undeclared (first use this function)
      1.cpp:62: error: expected primary-expression before '[' token
      1.cpp:62: error: stray '\207' in program
      1.cpp:62: error: stray '\224' in program
      1.cpp:62: error: stray '\212' in program
      1.cpp:62: error: stray '\188' in program
      1.cpp:62: error: stray '\188' in program
      1.cpp:62: error: stray '\211' in program
      1.cpp:62: error: stray '\196' in program
      1.cpp:62: error: stray '\195' in program
      1.cpp:62: error: stray '\180' in program
      1.cpp:62: error: stray '\243' in program
      1.cpp:62: error: expected primary-expression before ':' token
      1.cpp:62: error: expected `]' before ':' token
      1.cpp:62: error: expected `;' before ':' token
      1.cpp:62: error: stray '\183' in program
      1.cpp:62: error: stray '\227' in program
      1.cpp:62: error: stray '\207' in program
      1.cpp:62: error: stray '\194' in program
      1.cpp:62: error: stray '\194' in program
      1.cpp:62: error: stray '\219' in program
      1.cpp:62: error: stray '\204' in program
      1.cpp:62: error: stray '\179' in program
      1.cpp: In function `int main(int, char**)':
      1.cpp:123: error: `isdigit' undeclared (first use this function)
      1.cpp:124: error: stray '\163' in program
      1.cpp:124: error: stray '\188' in program
      1.cpp:124: error: `r' undeclared (first use this function)
      1.cpp:124: error: expected `;' before "o"
      1.cpp:124: error: stray '\163' in program
      1.cpp:124: error: stray '\190' in program
      1.cpp:186: error: stray '\183' in program
      1.cpp:186: error: stray '\227' in program
      1.cpp:186: error: stray '\207' in program
      1.cpp:186: error: stray '\194' in program
      1.cpp:186: error: stray '\194' in program
      1.cpp:186: error: stray '\219' in program
      1.cpp:186: error: stray '\204' in program
      1.cpp:186: error: stray '\179' in program
      1.cpp:186: error: `www' undeclared (first use this function)
      1.cpp:186: error: `forum' undeclared (first use this function)
      1.cpp:186: error: expected `;' before '}' token更多精彩文章及讨论,请光临枫下论坛 rolia.net
      • Sorry, this one, pls:
        本文发表在 rolia.net 枫下论坛root@mars larry]# gcc 1.cpp

        1.cpp:1:20: stdafx.h: No such file or directory
        1.cpp: In function `void write_symmetric_pair(char*, char*)':
        1.cpp:26: error: `isalpha' undeclared (first use this function)
        1.cpp:26: error: (Each undeclared identifier is reported only once for each function it appears in.)
        1.cpp: In function `void write_symmetric_triple(char*, char*)':
        1.cpp:58: error: `isalpha' undeclared (first use this function)
        1.cpp:62: error: expected primary-expression before '[' token
        1.cpp:62: error: stray '\207' in program
        1.cpp:62: error: stray '\224' in program
        1.cpp:62: error: stray '\212' in program
        1.cpp:62: error: stray '\188' in program
        1.cpp:62: error: stray '\188' in program
        1.cpp:62: error: stray '\211' in program
        1.cpp:62: error: stray '\196' in program
        1.cpp:62: error: stray '\195' in program
        1.cpp:62: error: stray '\180' in program
        1.cpp:62: error: stray '\243' in program
        1.cpp:62: error: expected primary-expression before ':' token
        1.cpp:62: error: expected `]' before ':' token
        1.cpp:62: error: expected `;' before ':' token
        1.cpp:62: error: stray '\183' in program
        1.cpp:62: error: stray '\227' in program
        1.cpp:62: error: stray '\207' in program
        1.cpp:62: error: stray '\194' in program
        1.cpp:62: error: stray '\194' in program
        1.cpp:62: error: stray '\219' in program
        1.cpp:62: error: stray '\204' in program
        1.cpp:62: error: stray '\179' in program
        1.cpp: In function `int main(int, char**)':
        1.cpp:123: error: `isdigit' undeclared (first use this function)
        1.cpp:124: error: stray '\163' in program
        1.cpp:124: error: stray '\188' in program
        1.cpp:124: error: `r' undeclared (first use this function)
        1.cpp:124: error: expected `;' before "o"
        1.cpp:124: error: stray '\163' in program
        1.cpp:124: error: stray '\190' in program
        1.cpp:186: error: stray '\183' in program
        1.cpp:186: error: stray '\227' in program
        1.cpp:186: error: stray '\207' in program
        1.cpp:186: error: stray '\194' in program
        1.cpp:186: error: stray '\194' in program
        1.cpp:186: error: stray '\219' in program
        1.cpp:186: error: stray '\204' in program
        1.cpp:186: error: stray '\179' in program
        1.cpp:186: error: `www' undeclared (first use this function)
        1.cpp:186: error: `forum' undeclared (first use this function)
        1.cpp:186: error: expected `;' before '}' token更多精彩文章及讨论,请光临枫下论坛 rolia.net
        • 1, remove the first line; 2. Rolia insert some "watermark" text in the file, though you cannot see them on screen, you will be able to see them in text editor, delete them.