I have an AVOption structure:
static const AVOption options[] = {
COMMON_OPTIONS // error here
{ NULL }
};
and COMMON_OPTIONS is defined as:
#define COMMON_OPTIONS \
{ "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_TETRAHEDRAL}, 0, NB_INTERP_MODE-1, FLAGS, "interp_mode" }, \
{NULL}
I am getting an error:
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(98): error C2143: syntax error : missing '}' before '.'
Your COMMON_OPTIONS macro has already the { NULL } and does not ends with a ,, so:
static const AVOption options[] = {
COMMON_OPTIONS
};
will solve your problem.
Past answer before the edit:
Even if we don't know what does COMMON_OPTIONS expand to, I guess that you just miss the comma after it:
static const AVOption options[] = {
COMMON_OPTIONS,
// ^
{ NULL }
};
Related
i have code. but I can not understand why he swears?
This is line 17
if (!empty($city_result = $this->model_module_novapochta->getCity($this->request->post['novaposhta_key']))) {
**Parse error: syntax error, unexpected '=', expecting ')' in /home/s2332/***.com/www/admin/controller/shipping/novaposhta.php on line 17**
if (!empty($this->request->post['refresh']) && !empty($this->request->post['novaposhta_key'])) {
if (!empty($city_result = $this->model_module_novapochta->getCity($this->request->post['novaposhta_key']))) {
$this->session->data['error'] = $city_result;
} elseif (!empty($address_result = $this->model_module_novapochta->getAdress($this->request->post['novaposhta_key']))) {
$this->session->data['error'] = $address_result;
}
};
Your if statement is wrong...
You have write:
if (!empty($city_result = $this->model_module_novapochta->getCity($this->request->post['novaposhta_key']))) {
must be:
$city_result = $this->model_module_novapochta->getCity($this->request->post['novaposhta_key']);
if (!empty($city_result)) {
//your code here
I would like to run an application in qt creator. But when i click on build, it showing error in carddetect.cpp
The error occurs here: void CardDetect::aamvaIssuerList()
But I can't find out what that error is.
124: error: C2059: syntax error : '{'
124: error: C2143: syntax error : missing ';' before '{'
124: error: C2143: syntax error : missing ';' before '}'
This is my code:
#include "carddetect.h"
#include <QDebug>
void CardDetect::aamvaIssuerList(){
issuerList [ "636026" ] = (struct issuer) {"Arizona", "AZ", "L"};
issuerList [ "0636021"] = (struct issuer) { "Arkansas", "AR", "" };
issuerList [ "636014" ] = (struct issuer) { "California", "CA", "L" };
issuerList [ "636020" ] = (struct issuer) { "Colorado", "CO", "NN-NNN-NNNN" };
issuerList [ "636010" ] = (struct issuer) { "Florida", "FL", "LNNN-NNN-NN-NNN-N" };
issuerList [ "636018" ] = (struct issuer) { "Iowa", "IA", "NNNLLNNNN" };
}
and carddetect.h is
#ifndef CARDDETECT_H
#define CARDDETECT_H
#include <QMap>
#include "magcard.h"
struct issuer {
QString name;
QString abbreviation;
QString format;
};
class CardDetect {
public:
CardDetect( MagCard *_card = 0 );
void setCard( MagCard *_card );
private:
MagCard *card;
void processCard();
void luhnCheck();
void creditCardCheck();
void aamvaCardCheck( QString expDate );
void aamvaIssuerList();
QMap<QString,struct issuer> issuerList;
};
#endif // CARDDETECT_H
That code working #keltar
but now in this function
void CardDetect::aamvaCardCheck( QString expDate ) {
if( card->encoding == IATA )
return; //we're only going to support ABA for now
struct issuer issuerInfo;
QString iin = card->accountNumber.left( 6 );
issuerInfo = issuerList.value( iin );
if( issuerInfo.name.isEmpty() ) {
iin = card->accountNumber.mid( 1, 6 );
issuerInfo = issuerList.value( iin );
if( issuerInfo.name.isEmpty() )
return; // this is not a known AAMVA card, abort
}
It showing error
error: C2512: 'issuer' : no appropriate default constructor available
error: C2512: 'issuer::issuer' : no appropriate default constructor available
in struct issuer issuerInfo;
Since you cannot use compound literals, here is an example of how it could be done:
Add constructor to your structure:
struct issuer {
issuer(const char *nm, const char *abbr, const char *fmt) : name(nm),
abbreviation(abbr), format(fmt) {}
QString name;
QString abbreviation;
QString format;
};
And change your function to:
void CardDetect::aamvaIssuerList(){
issuerList [ "636026" ] = issuer("Arizona", "AZ", "L");
// same for the rest of the lines
}
There are other ways to do the same, of course.
I have an structure AVFilter,
AVFilter avfilter_vsrc_color = {
.name = "color", // error here
.description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
.priv_class = &color_class,
.priv_size = sizeof(TestSourceContext),
.init = color_init,
.uninit = uninit,
.query_formats = color_query_formats,
.inputs = NULL,
.outputs = color_outputs,
.process_command = color_process_command,
};
and AVFilter is defined as,
typedef struct AVFilter {
const char *name;
const char *description;
const AVFilterPad *inputs;
const AVFilterPad *outputs;
const AVClass *priv_class;
int flags;
int (*init)(AVFilterContext *ctx);
int (*init_dict)(AVFilterContext *ctx, AVDictionary **options);
void (*uninit)(AVFilterContext *ctx);
int (*query_formats)(AVFilterContext *);
int priv_size; ///< size of private data to allocate for the filter
struct AVFilter *next;
int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
int (*init_opaque)(AVFilterContext *ctx, void *opaque);
} AVFilter;
I m getting error like ,
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(268): error C2143: syntax error : missing '}' before '.'
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(268): error C2143: syntax error : missing ';' before '.'
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(268): error C2059: syntax error : '.'
Please let us know which line is 268!
Please try removing the comma for
.process_command = color_process_command,
and try compiling it again. if you can give us more details like which line is 268 it will be possible to find the reason!
i have problem to set in to c++ MACRO singletone function result .
this is what i have :
the macro
#define CCDICT_FOREACH(__dict__, __el__) \
CCDictElement* pTmp##__dict__##__el__ = NULL; \
if (__dict__) \
HASH_ITER(hh, (__dict__)->m_pElements, __el__, pTmp##__dict__##__el__)
and this is how i try to set it :
CCDictElement* pElement = NULL;
CCDICT_FOREACH(GameSingleTone::getInstance()->getGemsDictionary(), pElement)
{
}
the method getGemsDictionary() returns me:
CCDictionary*,gemsDictionary;
the compilation error im getting is (on the line of the MACRO):
error C2143: syntax error : missing ';' before '{'
but if i do :
CCDictionary* tempDictionary = CCDictionary::create();
tempDictionary = GameSingleTone::getInstance()->getGemsDictionary();
CCDICT_FOREACH(tempDictionary , pElement)
{
}
every thing is working .
why ?
Macros simply do text replacement. So when you do this:
CCDICT_FOREACH(GameSingleTone::getInstance()->getGemsDictionary(), pElement)
This line:
CCDictElement* pTmp##__dict__##__el__ = NULL; \
becomes this:
CCDictElement* pTmpGameSingleTone::getInstance()->getGemsDictionary()pElement = NULL;
Which is utter nonsense. This, on the other hand:
CCDICT_FOREACH(tempDictionary , pElement)
translates to this:
CCDictElement* pTmptempDictionarypElement = NULL;
Which is perfectly okay.
I am writing a front end for my C compiler, where in I am adding Type system currently. Previously I assumed everything was an int and hence the following rule worked fine.
declaration: datatype varList ';' { gTrace<<"declaration ";}
varList: IDENTIFIER { builder.addSymbol($1); }
| varList',' IDENTIFIER { builder.addSymbol($3); }
;
But now I also add type to the symbol, and hence modified my rule like below:
declaration: datatype { currentType = $1; } varList ';' { gTrace<<"declaration "; currentType = -1; }
varList: IDENTIFIER { builder.addSymbol($1, getType(currentType)); }
| varList',' IDENTIFIER { builder.addSymbol($3, getType(currentType)); }
;
I get a shift/reduce error when I do that, since the { currentType = $1; } is being considered as an empty rule. How do I go about this error? Is there a way to specify that it is just an action?
Attached below is a snippet from my y.output
32 $#6: /* empty */
33 declaration: datatype $#6 varList ';'
34 varList: IDENTIFIER
35 | varList ',' IDENTIFIER
I don't get any error or warnings:
%token INT
%token FLOAT
%token CHAR
%token IDENTIFIER
%%
declaration: datatype { currentType = $1; } varList ';' { gTrace<<"declaration "; currentType = -1; }
varList : IDENTIFIER { builder.addSymbol($1, getType(currentType)); }
| varList ',' IDENTIFIER { builder.addSymbol($3, getType(currentType)); }
;
datatype: INT
| FLOAT
| CHAR
;
%%
Command
% bison p.yacc
%
I think you will need to provide more information.
The full yacc file and the parameters you are passing to yacc/bison
Edit
I tried your file (as per the comment) I still get no errors or warnings:
> yacc --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I fixed the problem as below:
declaration: datatype varList ';' { gTrace<<"declaration "; currentType = -1; }
varList: IDENTIFIER { builder.addSymbol($1, getType(currentType)); }
| varList',' IDENTIFIER { builder.addSymbol($3, getType(currentType)); }
;
datatype: INTEGER { gTrace<<"int "; $$ = currentType = Type::IntegerTy; }
| FLOAT { gTrace<<"float "; $$ = currentType = Type::FloatTy; }
| VOID { gTrace<<"void "; $$ = currentType = Type::VoidTy; }
;
#sarnold, hope this helps!
I thing you can only define an actions block for each rule, so
declaration: datatype { currentType = $1; } varList ';' { gTrace<<"declaration "; currentType = -1; }
should be done as
declaration: datatype varList ';' { currentType = $1; gTrace<<"declaration "; currentType = -1; }
Anyway, you are setting currentType to the lexical value of datatype and to -1 right after