Error expected identifier or before token

Program brief overview (3 body problem): #include #include #include double ax, ay, t; double dt; /* other declarations including file output, N and 6

Program brief overview (3 body problem):

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

double ax, ay, t;
double dt;
/* other declarations including file output, N and 6 command line arguments */
...

int main(int argc, char *argv[])
{
  int validinput;
  ...
  /* input validation */

  output = fopen("..", "w");
  ...
  /* output validation */

  for(i=0; i<=N; i++)
  {
    t = t + dt;
    vx = ...
    x = ...
    vy = ...
    y = ...
    fprintf(output, "%lf %lf %lfn", t, x, y);
  }

  fclose (output);

}

/* ext function to find ax, ay at different ranges of x and y */
{ 
  declarations

  if(x < 1)
  {
    ax = ...
  }

  else if(x==1)
  {
    ax = ...
  }
  ...
  else
  {
    ...
  }

  if(y<0)
  {
    ...
  }

  ...

}

I get an error on the line ‘{ /* ext function to find ax, ay at different ranges of x and y */’ saying "error: expected identifier or '(' before '{' token"

I think it may be due to not calling or creating the external function in the right way

STAR1337

0 / 0 / 0

Регистрация: 20.12.2017

Сообщений: 19

1

04.02.2018, 19:30. Показов 11602. Ответов 6

Метки нет (Все метки)


Помогите исправить функцию

Вот такая ошибка: prog.c:25:1: error: expected identifier or ‘(’ before ‘{’ token
{
^

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
 
int kek(double x1,double x2,double y1,double y2,double a,double b,double V)
 
{
        printf("Enter the x1n");
        scanf("%lf",&x1);
        printf("Enter the x2n");
        scanf("%lf",&x2);
        printf("Enter the y1n");
        scanf("%lf",&y1);
        printf("Enter the y2n");
        scanf("%lf",&y2);
        
    a = (x1*x2+y1*y2);
    b = sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2);
    V = a/b ;
    
    printf("%lfn",V);
    return 0;
}
 
{
    
    int x1,x2,y1,y2,a,b,V;
    V = kek(x1,x2,y1,y2,a,b)
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

04.02.2018, 19:30

Ответы с готовыми решениями:

Ошибка в строке 97: «incompatible types», а в 99 ошибка: «identifier expected but ‘^’ found», как исправить?
var
tmp,tmp1,tmp2:point;
begin
tmp:=head;
while tmp &lt;&gt; nil do
begin
tmp1:=…

Ошибка: Fatal: Syntax error, «;» expected but «identifier Mas» found.
Где здесь синтаксическая ошибка( &quot;mas:=A2;&quot; )?

procedure TForm1.Button1Click(Sender: TObject);

Ошибка: «expected constructor, destructor, or type conversion before ‘(‘ token»
connect(CommandLinkButton,clicked(),MainWindow,MainWindow::knopka());
Выдаёт ошибку expected…

Ошибка «expected primary-expression before ‘>’ token»
Задача: Задано линейный массив целых чисел. Увеличить на 2 каждый неотъемлемый элемент
массива….

6

Заклинатель змей

611 / 508 / 213

Регистрация: 30.04.2016

Сообщений: 2,412

04.02.2018, 19:35

2

STAR1337, main() сам себя напишет?



0



STAR1337

0 / 0 / 0

Регистрация: 20.12.2017

Сообщений: 19

04.02.2018, 21:27

 [ТС]

3

DobroAlex, я не понял куда его вставить можно показать?

Добавлено через 1 час 16 минут
Все равно не работает

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
 
int main ()
int kek(double x1,double x2,double y1,double y2,double a,double b,double V)
 
{
        printf("Enter the x1n");
        scanf("%lf",&x1);
        printf("Enter the x2n");
        scanf("%lf",&x2);
        printf("Enter the y1n");
        scanf("%lf",&y1);
        printf("Enter the y2n");
        scanf("%lf",&y2);
        
    a = (x1*x2+y1*y2);
    b = sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2);
    V = a/b ;
    
    printf("%lfn",V);
    return 0;
}
 
{
    
    int x1,x2,y1,y2,a,b,V;
    V = kek(x1,x2,y1,y2,a,b)
}



0



Супер-модератор

Эксперт Pascal/DelphiАвтор FAQ

32451 / 20945 / 8105

Регистрация: 22.10.2011

Сообщений: 36,213

Записей в блоге: 7

04.02.2018, 21:29

4

Перенести содержимое 5-ой строки в 25-ю попробуй… Вдруг получится?



0



STAR1337

0 / 0 / 0

Регистрация: 20.12.2017

Сообщений: 19

04.02.2018, 22:51

 [ТС]

5

volvo, я пробовал, не работает

Вот рабочий код и из него надо сделать функцию

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
 
int main()
 
{
    double x1,x2,y1,y2,a,b,V;
    
        printf("Enter the x1n");
        scanf("%lf",&x1);
        printf("Enter the x2n");
        scanf("%lf",&x2);
        printf("Enter the y1n");
        scanf("%lf",&y1);
        printf("Enter the y2n");
        scanf("%lf",&y2);
        
    a = (x1*x2+y1*y2);
    b = sqrt(x1*x1+y1*y1);
    V = a/(b*b);
    
    {printf("%lfn",V);}
    return 0;
}

Добавлено через 1 час 8 минут
Все я исправил свои ошибки

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
 
 
float function(float x1,float x2,float y1,float y2,float a,float b)
{
  float V;
    a = (x1*x2+y1*y2);
    b = sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2);
    V = a/b;
  return(V);
}
 
int main()
 
{
    double x1,x2,y1,y2,a,b,V;
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&x2,&y1,&y2,&a,&b);
    V=function(x1,x2,y1,y2,a,b);
    printf("%lf",V);
    system("PAUSE");
    return 0;
}



0



ogner

22 / 26 / 4

Регистрация: 26.03.2017

Сообщений: 187

04.02.2018, 22:52

6

Лучший ответ Сообщение было отмечено STAR1337 как решение

Решение

STAR1337,
Устроит?

C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
 
double func(double, double, double, double);
 
int main()
{
    double x1,x2,y1,y2;
    
        printf("Enter the x1n");
        scanf("%lf",&x1);
        printf("Enter the x2n");
        scanf("%lf",&x2);
        printf("Enter the y1n");
        scanf("%lf",&y1);
        printf("Enter the y2n");
        scanf("%lf",&y2);
     
    printf("%lfn",func(x1,x2,y1,y2));
    return 0;
}
 
double func(double x1, double x2, double y1, double y2){
    double a,b,V;
    
    a = (x1*x2+y1*y2);
    b = sqrt(x1*x1+y1*y1);
    
    return V = a/(b*b);
    
}



1



0 / 0 / 0

Регистрация: 20.12.2017

Сообщений: 19

04.02.2018, 22:56

 [ТС]

7

ogner, Да, спасибо :3



0



You should just pass pointers (since if you pass arrays to a function, what;’s really passed is a pointer anyway). Also, you can’t return an array — again, just return a pointer:

int* _addInts(int *x, int *y);  // equivalent to: int* _addInts(int x[], int y[]);

You’ll also have to arrange for the number of elements to be passed in somehow. Something like the following might work for you:

int* _addInts(int *x, int *y, size_t count);

Also — do not fall into the trap of trying to use sizeof on array parameters, since they’re really pointers in C:

int* _addInts(int x[], int y[])
{
     // the following will always print the size of a pointer (probably
     //     4 or 8):
     printf( "sizeof x: %u, sizeof y: %un", sizeof(x), sizeof(y));
}

That’s one reason why I’d prefer having the parameters be declared as pointers rather than arrays — because they really will be pointers.

See Is there a standard function in C that would return the length of an array? for a macro that will return the number of elements in an array for actual arrays and will cause a compiler error (on most compilers) much of the time when you try to use it on pointers.

If your compiler is GCC, you can use Linux’s trick: Equivalents to MSVC’s _countof in other compilers?

04-13-2013


#1

ChickenChowMinh is offline


Registered User


C and Assembly (error: expected identifier or ‘(‘ before ‘.’ token)

So I’m having trouble linking my assembly code into my C code. Simply, I have one program, but I’m using two different source codes to implement this one program.

For the assembly code, I simply converted from C to assembly using the linux command line «gcc -S..». I ran my program with an equivalent C code and it worked perfectly. But when I try to use assembly with it..it just doesn’t work. So I don’t think it has anything to do with the code. I think I may be linking it incorrectly. Do you guys have more knowledge about this stuff? D:

(I’ll post all of my codes so you guys can see what I’m working with and the errors I’m getting)

«formula.c»
C source code:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "nCr.s"

int isNumeric(char *num);
int form(int power);

int main(int argc, char *argv[]){

    clock_t start, end;
    double time;
    int num;
    char value[50];

    //error checking
    if(argc<2){
        printf("There are no argumentsn");
    }else if(argc>2){
        printf("There are too many argumentsn");
    }else{
        strcpy(value,argv[1]);

        if(value=="-h"){
            printf("Usage: formula<positive integern");
        }else{
            if(isNumeric(value)==0){
                printf("This must be a number or type -h for helpn");
                return;
        {     }

            num = atoi(value);
            if(num<0){
                printf("Number must have a positive valuen");
            }else{
                start = clock(); //start of time
                form(num);
                end = clock(); //end of time
                time = ((double)(end-start)/CLOCKS_PER_SEC)*1000000;
                printf("nTime Required = %.0f microsecondn", time);
            }
        }
    }

    return 0;
}

int isNumeric(char *num){
    char *val; //returns 0 if number and 1 if it's not..

    if (num == NULL || *num == '' || isspace(*num)){
      return 0;
    }

    strtod(num, &val);
    return *val == '';
}

int form(int power){
    int powerInd;
    int index = 0;
    int val;

    printf("(1 + x)^%d = ",power);

    if(power==0){
        printf("1");
        return;
    }

    powerInd=power;
    while(powerInd>0){
        if(index==0){
            printf("1 ");
            index++;
        }else{
            val = nCr(power,index);
            printf(" + %d*x^%d",val,index);
            index++;
            powerInd--;
        }
    }
}

«nCr.s»
ASSEMBLY source code:

Code:

.globl nCr
    .type    nCr, @function
nCr:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    subq    $32, %rsp
    movl    %edi, -20(%rbp)
    movl    %esi, -24(%rbp)
    movl    -24(%rbp), %eax
    movl    -20(%rbp), %edx
    movl    %edx, %ecx
    subl    %eax, %ecx
    movl    %ecx, %eax
    movl    %eax, -12(%rbp)
    movl    -12(%rbp), %eax
    movl    %eax, %edi
    call    Factorial
    movl    %eax, -12(%rbp)
    movl    -20(%rbp), %eax
    movl    %eax, %edi
    call    Factorial
    movl    %eax, -20(%rbp)
    movl    -24(%rbp), %eax
    movl    %eax, %edi
    call    Factorial
    movl    %eax, -24(%rbp)
    movl    -24(%rbp), %eax
    imull    -12(%rbp), %eax
    movl    %eax, -4(%rbp)
    movl    -20(%rbp), %eax
    movl    %eax, %edx
    sarl    $31, %edx
    idivl    -4(%rbp)
    movl    %eax, -8(%rbp)
    movl    -8(%rbp), %eax
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size    nCr, .-nCr
    
    .globl Factorial
    .type    Factorial, @function
Factorial:
.LFB1:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    movl    %edi, -20(%rbp)
    movl    $1, -4(%rbp)
    jmp    .L4
.L5:
    movl    -4(%rbp), %eax
    imull    -20(%rbp), %eax
    movl    %eax, -4(%rbp)
    subl    $1, -20(%rbp)
.L4:
    cmpl    $0, -20(%rbp)
    jg    .L5
    movl    -4(%rbp), %eax
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc

«nCr.h»
ASSEMBLY header file

Code:

#ifndef _NCR_H_
#define _NCR_H_

extern int nCr(int n, int r);
extern int Factorial(int n);

#endif /* _NCR_H_ */

MY ERROR!!!:

Code:

nCr.s:1: error: expected identifier or '(' before '.' token
nCr.s:2: error: stray '@' in program
nCr.s:51: error: stray '@' in program
make: *** [formula.o] Error 1


04-13-2013


#2

stahta01 is offline


Registered User


Why do you think this line is valid in C.I see no reason to believe your assembly code is valid C code as you included it.

You may have meant to do this

Tim S.

Last edited by stahta01; 04-13-2013 at 10:27 PM.

«…a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match..» Bill Bryson


04-13-2013


#4

Salem is online now


and the hat of int overfl

Salem's Avatar


Do what stahta01 suggests, then compile with

gcc nCr.s formula.c


04-13-2013


#7

Salem is online now


and the hat of int overfl

Salem's Avatar


> formula.o: formula.o
Surely some mistake — how can a file depend on itself?

> How would I incorporate nCr.s into my makefile?
In the same way you have a .c to .o rule, you would have a .s to .o rule as well.

Then the executable depends on all the .o file(s)


04-14-2013


#12

Salem is online now


and the hat of int overfl

Salem's Avatar


> I realized that I was making my makefile longer than it should have been, but it works better now.
You’ve made the makefile shorter, but you’ve increased the amount of work that needs to be done each time you build the program.

You’re recompiling everything, even when only one thing has changed. When you have projects with 1000’s of files, having efficient makefiles is a must.

Code:

formula: nCr.o formula.o
    $(COMPILER) $(CCFLAGS) nCr.o formula.o -o formula

nCr.o : nCr.s
    $(COMPILER) $(CCFLAGS) -c nCr.s

formula.o : formula.c
    $(COMPILER) $(CCFLAGS) -c formula.c


Hello,
I’m trying to work with I2C and I have the following code:

#include <stdio.h>
#include <avr/io.h>
#include <util/delay.h>
#include <compat/twi.h>
#define I2C_START
#define MAX_TRIES
#define I2C_DATA
#define I2C_STOP
#define i2c_writebyte

unsigned char i2c_transmit(unsigned char type) {

 while (!(TWCR & (1 << TWINT)));
 
  return (TWSR & 0xF8);
}
  {
  switch(type) {
     case I2C_START:   
       TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN);
       break;
     case I2C_DATA: 
       TWCR = (1 << TWINT) | (1 << TWEN);
       break;
     case I2C_STOP: 
       TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO);
       return 0;
  }

  }

 int i2c_writebyte (unsigned int i2c_address, unsigned int dev_id,
                  unsigned int dev_addr,char data) {
  unsigned char n = 0;
  unsigned char twi_status;
  char r_val = -1;
i2c_retry:
  if (n++ >= MAX_TRIES) return r_val;
  twi_status=i2c_transmit(I2C_START);

int i2c_readbyte(unsigned int i2c_address, unsigned int dev_id,
                 unsigned int dev_addr, char *data)
{
  unsigned char n = 0;
  unsigned char twi_status;
  char r_val = -1;
i2c_retry:
  if (n++ >= MAX_TRIES) return r_val;
    twi_status=i2c_transmit(I2C_START);

    if (twi_status == TW_MT_ARB_LOST) goto i2c_retry;
  if ((twi_status != TW_START) && (twi_status != TW_REP_START)) goto i2c_quit;
    TWDR = (dev_id & 0xF0) | ((dev_addr << 1) & 0x0E) | TW_WRITE;
    twi_status=i2c_transmit(I2C_DATA);
    if ((twi_status == TW_MT_SLA_NACK) || (twi_status == TW_MT_ARB_LOST)) goto i2c_retry;
  if (twi_status != TW_MT_SLA_ACK) goto i2c_quit;
    TWDR = i2c_address;
    twi_status=i2c_transmit(I2C_DATA);
    if (twi_status != TW_MT_DATA_ACK) goto i2c_quit;
    TWDR = i2c_address >> 8;
    twi_status=i2c_transmit(I2C_DATA);
  
    if (twi_status != TW_MT_DATA_ACK) goto i2c_quit;  

  twi_status=i2c_transmit(I2C_START);
  if (twi_status == TW_MT_ARB_LOST) goto i2c_retry;
  if ((twi_status != TW_START) && (twi_status != TW_REP_START)) goto i2c_quit;
  TWDR = (dev_id & 0xF0) | ((dev_addr << 1) & 0x0E) | TW_READ;
  twi_status=i2c_transmit(I2C_DATA); 


  if ((twi_status == TW_MR_SLA_NACK) || (twi_status == TW_MR_ARB_LOST)) goto i2c_retry;
  if (twi_status != TW_MR_SLA_ACK) goto i2c_quit;
    twi_status=i2c_transmit(I2C_DATA);
  if (twi_status != TW_MR_DATA_NACK) goto i2c_quit;
    *data=TWDR;
  r_val=1;
i2c_quit:
    twi_status=i2c_transmit(I2C_STOP);
  return r_val;

}
int main(void)
{
   char buffer[34]= {0b00001111,0b11110000,
                     0b00000001,
    		     0b00000011,
		     0b00000110,
	  	     0b00001100,
		     0b00011001,
		     0b00110011,
		     0b01100110,
		     0b11001100,
		     0b10011000,
		     0b00110000,
		     0b01100000,
		     0b11000000,
		     0b10000000,
		     0b00000000,
		     0b00000000,
		     0b00000000,
		     0b10000000,
		     0b11000000,
		     0b01100000,
		     0b00110000,
		     0b10011000,
		     0b11001100,
		     0b01100110,
 	             0b00110011,
		     0b00011001,
		     0b00001100,
		     0b00000110,
		     0b00000011,
		     0b00000001,
		     0b00000000,
		     0b00000000,
		     0b00000000,
		     };			
 char data,id1,id2;
  unsigned int dev_address,i,idelay;

  DDRD=0xFF;                   
  PORTD=0x00;                  
    ADMUX=0x00;	             
  
  ADCSRA = (1<<ADEN) | (1<<ADPS2) | (1<<ADPS1);
    ADCSRB = 0x00;
  
  DIDR0 = 0x01;
    TWSR = 0x00;  
    TWBR = 0x30;  

    dev_address=0;              
  i2c_readbyte(dev_address,EEPROM_ID,EEPROM_ADDR,&id1);
  i2c_readbyte(dev_address + 1,EEPROM_ID,EEPROM_ADDR,&id2);
    if (id1 != buffer[0] || id2 != buffer[1]) {
    for(i=0;i < 34;i++) {
       i2c_writebyte(dev_address + i,EEPROM_ID,EEPROM_ADDR,buffer[i]);
      _delay_us(1);
    }
  }   

idelay=100;  

  for(;;) {
    for(i=2;i < 34;i++) {
     
      ADCSRA |= (1<<ADSC);
     
      while (ADCSRA & (1<<ADSC));
      idelay = ADCW;
      i2c_readbyte(dev_address + i,EEPROM_ID,EEPROM_ADDR,&data);
      PORTD=data;
      _delay_ms(idelay);  
    }
  }

  return 0;
}

I get 2 errors and 1 warning.
The errors are:
../1121.c:32: error: expected identifier or ‘(‘ before ‘unsigned’
../1121.c:17: error: expected identifier or ‘(‘ before ‘{‘ token


how can I fix them?
best regards,
Floris

Hi I’ve been writing a piece of code as part of university course and
I am getting an error and I can’t figure out how to fix it.

The code is meant to be a reverse polish notation calculator, the user
inputs digits and operators one at a time and the program either
pushes the numbers on to a stack or pops them off when it receives an
operator, performs the calculation, then pushes the result back on to
the stack.

Finally when the user inputs a equals sign the program displays the
results, this is how it’s meant to work anyway.

When I try to compile i get this error:
prog5.c:10: error: expected identifier or ‘(’ before ‘{’ token

BTW the simpleio.h is a library of input mechanisms given to us by our
university, they include the getInt() & getChar functions, supposedly
there to make our lives easier, anyway, the code:

#include <stdio.h>
#include <stdlib.h>
#include «../simpleio.h»

typedef struct CalcParam { int item;
struct calcParam * next;
} calcParam;

int main();
{
char item;
int temp1, temp2, temp3, answer;
calcParam * top;
calcParam * cpp;

printf(«Enter a reverse polish notation string, character by
character: n»);
printf(«Finish with ‘=’n»);
printf(«Next: «); item=getChar();

while(item!=’=’)
{
if (!(item>=’0′ && item<=’9′ || item==’+’ || item==’-‘ || item==’*’
|| item==’/’ ) //ccheck if input is valid
{
printf(«Not a valid input, valid input: digits 0-9, +, -, *, /»);
exit(1)
}

if (item>=’0′ && item<=’9′) //check if user input is a
number
{
if(!(cpp = (calcParam *) malloc(sizeof(calcParam)); //check if
memory can be allocated
{
printf(«Cannot allocate memoryn»);
exit(1);
}
atoi(&item); //convert input char to int ready to push on
to stack
cpp->item=item; //push number on to stack
cpp->next = top;
top = cpp;
printf(«Next: «); item=getChar();
}
if (item==’+’ || item==’-‘ || item==’*’ || item==’/’) //
check if user input is an operator
{
temp1=top->item; //pop first item and put it in
temp1
cpp = top;
top = top->next;
free(ccp);
temp2=top->item; //pop second item and put it in
temp2
cpp = top;
top = top->next;
free(ccp);
temp3 = temp2 item temp1; //perform arithmetic and
store answer in temp3

if(!(cpp = (calcParam *) malloc(sizeof(calcParam)); //
check if memory can be allocated
{
printf(«Cannot allocate memoryn»);
exit(1);
}
cpp->item=temp3; //push temp3 on to stack
cpp->next = top;
top = cpp;
printf(«Next: «); item=getChar();
}
}
answer=top->item; //pop answer
cpp = top;
top = top->next;
free(ccp);
printf(«Answer: «, answer);
return 0;
}

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

GerogeFu opened this issue

Dec 28, 2016

· 7 comments

Comments

@GerogeFu

when i try to compile CuraEngine in Centos 7 , after installing libArcus , i got these errors:

[ 6%] Building CXX object CMakeFiles/_CuraEngine.dir/src/bridge.cpp.o
In file included from /usr/local/src/CuraEngine/src/pathPlanning/Comb.h:11:0,
from /usr/local/src/CuraEngine/src/gcodePlanner.h:8,
from /usr/local/src/CuraEngine/src/sliceDataStorage.h:11,
from /usr/local/src/CuraEngine/src/bridge.cpp:4:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(Args …)’:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:18:error: expected ‘,’ before ‘…’ token
args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:18:error: expected identifier before ‘…’ token
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:21:error: parameter packs not expanded with ‘…’:
args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:21:note: ‘args’
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:36:34:error: expansion pattern ‘args’ contains no argument packs
return new T(args…);
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(const std::function<_Res(_ArgTypes …)>&, Args …)’:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:21:error: expected ‘,’ before ‘…’ token
f, args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:21:error: expected identifier before ‘…’ token
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:24:error: parameter packs not expanded with ‘…’:
f, args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:24:note: ‘args’
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:54:36:error: expansion pattern ‘args’ contains no argument packs
return new T(f(args…));
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(const std::function<T*(Args …)>&, Args …)’:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:21:error: expected ‘,’ before ‘…’ token
f, args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:21:error: expected identifier before ‘…’ token
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:24:error: parameter packs not expanded with ‘…’:
f, args…
^
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:24:note: ‘args’
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function:
/usr/local/src/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:70:30:error: expansion pattern ‘args’ contains no argument packs
return f(args…);

@GerogeFu
GerogeFu

changed the title
error: ‘class Arcus::Socket’ has no member named ‘state’

error: expected identifier before ‘…’ token when compiling the master

Dec 28, 2016

@Ghostkeeper

It’s breaking over variadic arguments in a lambda function. The code is valid, but your compiler doesn’t seem to support it.

I suggest you try with a newer version of the compiler.

@awhiemstra

@BagelOrb

@awhiemstra

@BagelOrb

That looks to me like trying to compile a fairly old CuraEngine against a fairly new libArcus. It is complaining that registerMessage(int, Message*) does not match with registerMessage(Message*). The int was removed a while ago since we now auto-generate type identifiers.

@BagelOrb

@Gaspounet

I am having a similar issue, and I have no idea how to fix it.
I’m trying to build on Ubuntu 14.04 Server and I get this error:

~/CuraEngine/build$ make Scanning dependencies of target clipper [ 1%] Building CXX object CMakeFiles/clipper.dir/libs/clipper/clipper.cpp.o Linking CXX static library libclipper.a [ 1%] Built target clipper [ 2%] Running C++ protocol buffer compiler on Cura.proto Scanning dependencies of target _CuraEngine [ 4%] Building CXX object CMakeFiles/_CuraEngine.dir/src/bridge.cpp.o [ 5%] Building CXX object CMakeFiles/_CuraEngine.dir/src/commandSocket.cpp.o In file included from /home/gaspounet/CuraEngine/src/pathPlanning/Comb.h:11:0, from /home/gaspounet/CuraEngine/src/LayerPlan.h:8, from /home/gaspounet/CuraEngine/src/FffGcodeWriter.h:15, from /home/gaspounet/CuraEngine/src/FffProcessor.h:5, from /home/gaspounet/CuraEngine/src/commandSocket.cpp:7: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(Args ...)’: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:18: error: expected ‘,’ before ‘...’ token [args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:18: error: expected identifier before ‘...’ token /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:21: error: parameter packs not expanded with ‘...’: [args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:34:21: note: ‘args’ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:36:34: error: expansion pattern ‘args’ contains no argument packs return new T(args...); ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(const std::function<_Res(_ArgTypes ...)>&, Args ...)’: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:21: error: expected ‘,’ before ‘...’ token [f, args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:21: error: expected identifier before ‘...’ token /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:24: error: parameter packs not expanded with ‘...’: [f, args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:52:24: note: ‘args’ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:54:36: error: expansion pattern ‘args’ contains no argument packs return new T(f(args...)); ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In constructor ‘cura::LazyInitialization<T, Args>::LazyInitialization(const std::function<T*(Args ...)>&, Args ...)’: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:21: error: expected ‘,’ before ‘...’ token [f, args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:21: error: expected identifier before ‘...’ token /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:24: error: parameter packs not expanded with ‘...’: [f, args...]() ^ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:68:24: note: ‘args’ /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h: In lambda function: /home/gaspounet/CuraEngine/src/pathPlanning/../utils/LazyInitialization.h:70:30: error: expansion pattern ‘args’ contains no argument packs return f(args...); ^ make[2]: *** [CMakeFiles/_CuraEngine.dir/src/commandSocket.cpp.o] Error 1 make[1]: *** [CMakeFiles/_CuraEngine.dir/all] Error 2 make: *** [all] Error 2

@Ghostkeeper

Still the same answer: You need to get a newer compiler version!

Понравилась статья? Поделить с друзьями:
  • Error expected identifier or before string constant
  • Error expected identifier or before numeric constant
  • Error execution failed with error code 1
  • Error expected for function style cast or type construction
  • Error expected expression before token что это