小编Zep*_*ock的帖子

找不到Maven依赖

我和我的朋友正在开发Java maven项目,设置与我们从git获取项目完全相同.在我的设置Maven正确导入所有依赖项,但对我的朋友,它将找不到任何依赖项.

我们尝试过的事情:

  • 卸载并重新安装Intellij

  • 无效缓存/重新启动

  • 删除.Intellij文件夹中的maven文件夹并删除*.iml和.idea文件夹并重新启动Intellij

  • 右键单击项目,单击maven并单击重新导入.

我们都可以访问互联网,因此也不应该是问题.此外,Maven设置为在Intellij中自动导入.

java intellij-idea maven

11
推荐指数
3
解决办法
4万
查看次数

从函数返回唯一的空指针

要从void *CI 中的函数获取 a将执行以下操作(非常基本的示例):

void *get_ptr(size_t size)
{
    void *ptr = malloc(size);
    return ptr;
}
Run Code Online (Sandbox Code Playgroud)

使用时如何获得相同的结果std::unique_ptr<>

c c++ unique-ptr

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

Firebase函数:无法读取未定义的属性"user_id"

我试图用我的移动应用程序做一个简单的hello world firebase功能,我想记录用户ID,以便我可以看到该功能确实有效.这是我目前的javascript代码:

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.sendNotification = functions.database.ref('/notifications/{user_id}').onWrite((event) => {

  console.log('Testing stuff', event.params.user_id);

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

当新数据写入特定数据库表时会触发,但会显示以下错误:

TypeError: Cannot read property 'user_id' of undefined
    at exports.sendNotification.functions.database.ref.onWrite (/user_code/index.js:8:44)
    at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27)
    at next (native)
    at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
    at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
    at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36)
    at /var/tmp/worker/worker.js:700:26
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Run Code Online (Sandbox Code Playgroud)

通知数据库如下所示: 在此输入图像描述

node.js firebase firebase-realtime-database google-cloud-functions firebase-cloud-messaging

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

FFF 假函数与谷歌测试

我正在尝试使用 google test 测试我的 C 库,但在使用框架模拟函数时遇到问题fff.h。这是我的文件结构:

\n\n
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 configure.ac\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 include\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 public_header.h\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 private_functions.c\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 private_functions.h\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libmylib.la\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib.c\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 libmylib_test\n        \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile.am\n        \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 fff.h\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test.cc\n
Run Code Online (Sandbox Code Playgroud)\n\n

我想从标头模拟一个函数,该函数在使用框架private_functions.h的函数中使用。public_header.hfff.h

\n\n
public_function()\n{\n        private_function(); //This function is the one I want to mock.\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的测试如下所示:

\n\n
#include "gtest/gtest.h"\n#include "public_header.h"\n#include "fff.h"\n\nextern "C" {\n    #include "private_functions.h"\n}\n\nDEFINE_FFF_GLOBALS;\n\nFAKE_VALUE_FUNC(int, function, char *, char *);\n\nclass libtest : public testing::Test\n{\npublic:       \n    virtual void …
Run Code Online (Sandbox Code Playgroud)

c c++ automake googletest

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

无法在 Ubuntu 上运行 SDL(2),没有可用的视频设备

当我尝试运行我的程序时,我收到以下错误消息:

SDL could not initialize! SDL_Error: No available video device
Run Code Online (Sandbox Code Playgroud)

我已经安装了所有必需的 SDL 库,并且当前正在运行 ubuntu 15.10

这是我的简单 SDL 代码:

#include <stdio.h>
#include "SDL2/SDL.h"

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int main(int argc, char* argv[])
{
    //The window we'll be rendering to
    SDL_Window* window = NULL;

    //The surface contained by the window
    SDL_Surface* screenSurface = NULL;

    //Initialize SDL
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
    }
    else …
Run Code Online (Sandbox Code Playgroud)

c linux ubuntu sdl sdl-2

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