小编ale*_*lon的帖子

jquery mobile hashListeningEnabled即使设置为false也会一直监听哈希更改

这是我的理解

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).bind('mobileinit', function () {
    $.mobile.ajaxEnabled = false;
    $.mobile.hashListeningEnabled = false;
});
</script>
<script type="text/javascript" src="//code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

然后有些像html一样

<div data-role="content">
    <span id="lat"></span>
    <span id="long"></span>
    <ul data-role="listview" data-inset="true">
        <li>
            <a href="/#nowhere">Check out item one</a>
        </li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)
<div data-role="page" id="nowhere"></div>
Run Code Online (Sandbox Code Playgroud)

不应导致任何导航发生.不过确实如此.我真的想禁用哈希监听,以便我自己处理这些事件.

我错过了什么吗?或者这是一个错误?

jquery-mobile

4
推荐指数
1
解决办法
6532
查看次数

使用C++标头在简单C程序中链接错误

我正在关注一个介绍教程http://www.linuxinsight.com/files/alp/alp-ch01-getting-started.pdf.

我创建了源文件main.c,reciprocal.cpp和reciprocal.hpp.我已经能够成功编译这些文件.当我去链接它们时出现问题,我收到以下错误消息:

main.o: In function `main':
main.c:(.text+0x30): undefined reference to `reciprocal'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我认为这是不正确地使用头文件,但我真的不知道该尝试什么,因为我已经非常彻底地遵循了这些步骤.

如果有人知道为什么它会抛出那个错误我会非常感激.

谢谢

**UPDATE以下是三个源文件的代码:

main.c中

#include <stdio.h>
#include "reciprocal.hpp"

int main (int argc, char **argv) {
    int i;
    i = atoi(argv[1]);
    printf("The reciprocal of %d is %g\n", i, reciprocal(i));

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

reciprocal.cpp

#include <cassert>
#include "reciprocal.hpp"

double reciprocal(int i) {
    assert(i != 0);
    return 1.0/i;
}
Run Code Online (Sandbox Code Playgroud)

reciprocal.hpp

#ifdef __cplusplus
extern "C" {
#endif

double reciprocal(int i);

#ifdef __cplusplus
}
#endif …
Run Code Online (Sandbox Code Playgroud)

c c++ linker

3
推荐指数
1
解决办法
382
查看次数

标签 统计

c ×1

c++ ×1

jquery-mobile ×1

linker ×1