标签: syntax-error

C2061语法错误(标识符)

1>cb.c(51): error C2061: syntax error : identifier 'SaveConfiguration'
1>cb.c(51): error C2059: syntax error : ';'
1>cb.c(51): error C2059: syntax error : 'type'
1>cb.c(52): error C2061: syntax error : identifier 'LoadConfiguration'
1>cb.c(52): error C2059: syntax error : ';'
1>cb.c(52): error C2059: syntax error : 'type'
1>cb.c(122): error C2061: syntax error : identifier 'SaveConfiguration'
1>cb.c(122): error C2059: syntax error : ';'
1>cb.c(122): error C2059: syntax error : 'type'
1>cb.c(127): error C2061: syntax error : identifier 'LoadConfiguration'
1>cb.c(127): error C2059: syntax error : …
Run Code Online (Sandbox Code Playgroud)

c compiler-errors syntax-error

6
推荐指数
2
解决办法
1万
查看次数

取消绑定封闭范围引用的名称

从Python语言参考(v 3.1,请参阅此处 - http://docs.python.org/py3k/reference/executionmodel.html#naming-and-binding):

取消绑定封闭范围引用的名称是非法的; 编译器将报告一个SyntaxError.

但是当我运行以下代码时:

a = 3

def x():
  global a
  del(a)

print(a)
x()
Run Code Online (Sandbox Code Playgroud)

它工作正常; 当我改变通话顺序时:

x()
print(a)
Run Code Online (Sandbox Code Playgroud)

我得到一个NameError,而不是SyntaxError.显然,我不能正确理解规则.有人能解释一下吗?谢谢.

python syntax-error unbind

6
推荐指数
1
解决办法
757
查看次数

错误:'&'标记之前的声明符无效

我试图写一个允许用户使用的TextQuery程序:
1.输入一个单词
2. 读取文件
3. 打印出单词出现的行数和单词出现在该行上的次数.

我创建了一个名为"TextQuery"的类,其中包含3个成员函数:
1."read_file"用于读取文件并返回对向量的引用
2. "find_word"用于获取需要搜索的单词
然后返回对地图 的引用< int,pair>
(第一个'int'是行号,第二个'int'是单词出现在该行上的次数,'string'是整行)
3."write_out"写入结果.

但是,当我编译程序时,我收到了这条消息:

/home/phongcao/C++/textquery_class_1.cc:21: error: invalid declarator before ‘&’ token
Run Code Online (Sandbox Code Playgroud)


我只是想知道声明者怎么错?这是类定义部分:

#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>

using namespace std;

class TextQuery {
public:
  vector<string> &read_file(ifstream &infile) const;
  map< int, pair<string, int> > &find_word(const string &word) const;  
  void write_out(const string &word) const; …
Run Code Online (Sandbox Code Playgroud)

c++ stl compiler-errors g++ syntax-error

6
推荐指数
1
解决办法
1万
查看次数

没有$的变量,可以吗?

是否有可能在不使用$的情况下引用变量?

例如:

if ($a != 0 && a == true) {
...
}
Run Code Online (Sandbox Code Playgroud)

我不这么认为,但代码(不是我写的)没有显示错误,我认为这很奇怪.我忽略了代码,也不是常量.

php variables parsing syntax-error

6
推荐指数
1
解决办法
6923
查看次数

我在JavaScript中错误地转义字符串了吗?

我想在javascript中创建一个可点击的链接

var content = '<a href=\"#\" onclick=\"displayContent(\"TEST\")\">Whatever</a>';

$("#placeHolder").html(content);
Run Code Online (Sandbox Code Playgroud)

但我不断收到错误

未捕获的SyntaxError:意外的令牌}

这不是逃避双引号和创建链接的正确方法吗?

javascript jquery escaping syntax-error

6
推荐指数
1
解决办法
925
查看次数

Visual Studio不允许我使用某些变量名称

我正在使用Visual Studio 2010 Express.当我使用某些变量名称时,例如"near","far","IN","OUT",我无法编译:我在使用变量名后遇到语法错误.示例:

z = 1.0/(far - near);
Run Code Online (Sandbox Code Playgroud)

错误:

error C2059: syntax error : ')'
Run Code Online (Sandbox Code Playgroud)

如何禁用此"功能"?

syntax-error visual-studio visual-c++

6
推荐指数
1
解决办法
781
查看次数

Javascript:函数体后面的语法错误

好的,所以你知道错误,但为什么我得到它呢?当我在本地运行时,我没有任何错误,但是当我上传我的项目时,我遇到了这个恼人的语法错误.我检查了firebug错误控制台,这没有帮助,因为它把我所有的源都放在同一行,我已经通过Lint解析它似乎也没有找到问题 - 我刚刚格式化我的大括号以某种我讨厌的方式不同; 在声明的同一行,没有.

function ToServer(cmd, data) {
    var xmlObj = new XMLHttpRequest();
    xmlObj.open('POST', 'handler.php', true);
    xmlObj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    xmlObj.send(cmd + data);
    xmlObj.onreadystatechange = function() {
        if(xmlObj.readyState === 4 && xmlObj.status === 200) {
            if(cmd == 'cmd=push') {
                document.getElementById('pushResponse').innerHTML = xmlObj.responseText;
            }
            if(cmd == 'cmd=pop') {
                document.getElementById('messages').innerHTML += xmlObj.responseText;
            }
            if(cmd == 'cmd=login') {
                if(xmlObj.responseText == 'OK') {
                    self.location = 'index.php';
                }
                else {
                    document.getElementById('response').innerHTML = xmlObj.responseText;
                }
            }           
        }
    }
}

function Login() {
    // Grab username and password for …
Run Code Online (Sandbox Code Playgroud)

javascript ajax syntax-error

6
推荐指数
1
解决办法
1万
查看次数

如何在使用Lighttpd和Fast-CGI时显示PHP错误?

我使用FastCGI运行Lighttpd网络服务器,网络服务器不输出PHP解析错误.

我的php.ini文件有以下设置:

error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
html_errors = On
Run Code Online (Sandbox Code Playgroud)

我在我的PHP脚本中启用错误输出以进行开发(对于其他环境具有冗余):

error_reporting( E_ALL );
ini_set( 'display_errors', 1 );
ini_set( 'html_errors', 'On' );
Run Code Online (Sandbox Code Playgroud)

大多数错误输出正常.解析错误没有.下面是抛出解析错误的示例代码.Lighttpd网络服务器不输出错误,但是从命令行执行时,因为它没有使用FastCGI.(注意缺少的连接运算符):

<?php echo 'foo' 'bar'; ?>
Run Code Online (Sandbox Code Playgroud)

我发现如果我display_errors = On在php.ini中设置然后使用FastCGI和Lighttpd正确解析错误输出,但是我不能在我的PHP脚本中使用它来关闭它们ini_set( 'display_errors', 0 ).

我希望能够在开发它时在我的应用程序中显示这些,并且能够在不更改php.ini配置的情况下关闭它们进行生产.使用FastCGI时,我的PHP应用程序中无法执行此操作吗?

php runtime-error fastcgi lighttpd syntax-error

6
推荐指数
1
解决办法
8009
查看次数

在一个键列上加入两个DataFrame/ERROR:'列重叠但没有指定后缀'

我有两个表:销售表和产品表,这两个表共享'PART NUMBER'列.销售表中的"PART NUMBER"列不是唯一的,但在产品表中是唯一的.(参见下面的销售表和产品表快照的图片)

在此输入图像描述

在此输入图像描述

我试图在销售表上为每个'PART NUMBER'添加等效的'Description',然后我按照pandas网站上的示例我的代码

sales.join(part_table, on='PART NUMBER')
Run Code Online (Sandbox Code Playgroud)

但我得到了这个错误:

ValueError: columns overlap but no suffix specified: Index([u'PART NUMBER'], dtype='object')
Run Code Online (Sandbox Code Playgroud)

有人可以解释这个错误意味着什么以及如何解决它?

非常感谢!

python sql join syntax-error pandas

6
推荐指数
1
解决办法
2万
查看次数

下面的变量声明是否会导致词法错误或语法错误?

如果我声明变量就好

int a/*comment*/ ; //This does not give any error .
int a/*comment*/bc; This gives error
Run Code Online (Sandbox Code Playgroud)

现在我没有得到这背后的原因,据我说,当符号/被读取后第一次读取字符a时,它会切换到DFA的其他状态以识别其他一些模式,因此没有错误在读取注释后的第二种情况下,它会找到一些不属于正式模式的其他序列,因此它会在有限自动机的某些非最终状态中停止,因为它会产生错误.

请清除这种困惑.

c syntax compiler-errors syntax-error

6
推荐指数
3
解决办法
95
查看次数