小编Ins*_*nct的帖子

未定义的引用`LinkedList <int> :: push_front(int)

可能重复:
为什么在使用模板时会出现"未解析的外部符号"错误?

LinkedList.h

#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include<iostream>

template<class T> class LinkedList;

//------Node------
template<class T>
class Node {
private:
    T data;
    Node<T>* next;
public:
    Node(){data = 0; next=0;}
    Node(T data);
    friend class LinkedList<T>;

};


//------Iterator------
template<class T>
class Iterator {
private:
    Node<T> *current;
public:

    friend class LinkedList<T>;
    Iterator operator*();
 };

//------LinkedList------
template<class T>
class LinkedList {
private:
    Node<T> *head;


public:
    LinkedList(){head=0;}
    void push_front(T data);
    void push_back(const T& data);

    Iterator<T> begin();
    Iterator<T> end();

};



#endif  /* LINKEDLIST_H */
Run Code Online (Sandbox Code Playgroud)

LinkedList.cpp

#include "LinkedList.h" …
Run Code Online (Sandbox Code Playgroud)

c++ templates undefined-reference

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

如何在Windows上以独立模式设置Spark log4j路径?

我已经尝试将log4j.properties.template更改为hadoop-home/conf中的log4j.properties但是spark仍然没有把它拿起来.我试过设定

sparkconf.set("log4j.configuration", ".\\config\\log4j.properties");

但这也不起作用.我也尝试过添加

-Dlog4j.configuration=.\config\log4j.properties
Run Code Online (Sandbox Code Playgroud)

eclipse运行配置但不起作用.Spark在启动期间仍在使用其默认值

Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
Run Code Online (Sandbox Code Playgroud)

我还将SPARK_CONF_DIR设置为我的环境变量以指向spark/conf目录,但这似乎也不起作用.

我在eclipse中以windows独立模式运行它

SparkConf sparkConf = new SparkConf().setAppName("Test").setMaster("local[1]")
                .set("log4j.configuration", ".\\config\\log4j.properties");
Run Code Online (Sandbox Code Playgroud)

log4j apache-spark

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

如何使用mock websocket在服务函数中测试onMessage?

我有一个服务函数,它打开一个websocket,发送并处理响应的onMessage.我正在使用Jasmine尝试为此功能创建单元测试.

我希望能够在Jasmine中调用someService并接收带有假响应消息的promise对象.这样做的最佳方式是什么?

   callbacks = [];
   self.someService= function(){
            // Generate message
            var msg = "someMsg";

            // Create promise
            var deferred = $q.defer();
            callbacks[id] = deferred;

            // Open Socket
            var ws = $websocket("SomeConnectionPoint");

            // Send request
            ws.send(JSON.stringify(msg));

            // Message Return
            ws.onMessage(function(msg){
                var data = JSON.parse(msg.data);

                if (angular.isDefined(callbacks[id])) {
                    var callback = callbacks[id];
                    delete callbacks[id];
                    callback.resolve(msg);
                    ws.close();
                  } else {
                    console.error("Unhandled message", data);
                  }
            });
            return deferred.promise.then(function(response) {
                return response;
            });
        };
Run Code Online (Sandbox Code Playgroud)

unit-testing websocket jasmine karma-jasmine angular

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

简单的PHP Web搜寻器返回简单的HTML DOM错误

我有一个PHP脚本,可返回网页上的链接。我收到500内部错误,这就是我的服务器日志所说的。我让我的朋友在他的服务器上尝试相同的代码,它似乎可以正常运行。有人可以帮我调试我的问题吗?警告说有关包装器的信息已禁用。我检查了1081行,但没有看到allow_url_fopen

PHP警告:file_get_contents():在服务器配置中,http://包装器已被第1081行的/hermes/bosweb/web066/b669/ipg.streamversetv/simple_html_dom.php中的allow_url_fopen = 0禁用

PHP警告:file_get_contents(http://www.dota2lounge.com/):无法打开流:在第1081行的/hermes/bosweb/web066/b669/ipg.streamversetv/simple_html_dom.php中找不到合适的包装器

PHP致命错误:在/hermes/bosweb/web066/b669/ipg.streamversetv/sim中的非对象上调用成员函数find()

<?php
 include_once('simple_html_dom.php');
 $target_url = 'http://www.dota2lounge.com/';
 $html = new simple_html_dom();
 $html->load_file($target_url);
  foreach($html->find(a) as $link){
    echo $link->href.'<br />';
  }
?>
Run Code Online (Sandbox Code Playgroud)

php web-crawler

0
推荐指数
1
解决办法
2157
查看次数