c - expected identifier or '(' before '~' token -


i encountered problem while working on project. know there many simillar questions answered, regarding special 1 not find help. getting following error:

compiling main.c main.c:42:1: error: expected identifier or '(' before '~' token ~ ^ makefile:47: recipe target 'obj/main.o' failed make: *** [obj/main.o] error 1 

edit: deleted last lines of code, error still occures @ line after last '}'.

the project pagerank algorithm, using options in console choosing algorithm wished used. trying read or use options in command line, error stops me looking @ semantic of program.

/* * main.c * *programmierung 2 - projekt 2 (pagerank) */ #include <stdio.h> #include <stdlib.h> #include <getopt.h>  #include "utils.h" //is existing in directory   int main (int argc, char *const *argv) {     //initialize random number generator     rand_init();      printf("you gave %d command line arguments%c\n", argc-1, argc==1 ? '.' : ':');     int graph;     int = 1;     char * h = "-h show help. \n";     char * p = "...";     char * m = "...";     char * r = "...";     char * s = "...";     while ((graph = getopt(argc, argv, "hmprs")) != -1) {          switch (graph) {             default : printf("make -h | -m | -p | -r | -s "); break;             case 'h' : printf("%s %s %s %s %s"), h, m, p, r, s); break;             //this-like outcommended code 1 above             //and again              //and once more             //and final 1         }     printf(" - %s\n", argv[i]);     i++;     } exit(0); } 

one more thing: encountered problem regarding lengh of case 'h' : printf(), outcoded text in multiple chars. if need more information anything, ask me.

the compiler reports error on line 42, source in question 33 lines , contains no ~ character. need show entire source you're compiling.

but have guess.

the error message shows line ~ character in column 1 , nothing following it. vi (or vim) text editor uses ~ mark lines on screen aren't part of file. if copy-and-paste source file vi editor session, it's easy copy many lines , end ~ @ end of source file.

edit file, jump end, , delete line.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -