- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在使用 SDL2 库使用 pepper_46 构建应用程序时遇到问题。我搜索了互联网,终于找到了谷歌的 webports这使我能够正确地为 pnacl 编译 SDL2。
我现在遇到的问题实际上是用 makefile 编译一切...
这是我尝试编译的调用 SDL_Init 的最小 C++ 文件:
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
#include "SDL2/SDL.h"
class firstInstance : public pp::Instance {
public:
explicit firstInstance(PP_Instance instance) : pp::Instance(instance) {
SDL_Init(SDL_INIT_VIDEO);
}
virtual ~firstInstance() {}
};
class firstModule : public pp::Module {
public:
firstModule() : pp::Module() {}
virtual ~firstModule() {}
virtual pp::Instance* CreateInstance(PP_Instance instance) {
return new firstInstance(instance);
}
};
namespace pp {
Module* CreateModule(){
return new firstModule();
}
}
我还对我的 makefile 做了一些修改,希望它能正确编译:
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GNU Makefile based on shared rules provided by the Native Client SDK.
# See README.Makefiles for more details.
VALID_TOOLCHAINS := pnacl
NACL_SDK_ROOT ?= $(abspath $(CURDIR)/..)
TARGET = first
include $(NACL_SDK_ROOT)/tools/common.mk
LIBS = SDLmain SDL2 ppapi_gles2 ppapi_simple ppapi_cpp nacl_io ppapi pthread
CFLAGS = -Wall -std=c++11
SOURCES = first.cc
# Build rules generated by macros from common.mk:
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
# The PNaCl workflow uses both an unstripped and finalized/stripped binary.
# On NaCl, only produce a stripped binary for Release configs (not Debug).
ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG))))
$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
else
$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
endif
$(eval $(call NMF_RULE,$(TARGET)))
但我得到的最好结果是这个错误:
bobkingof12vs$ make serve
CXX pnacl/Release/first.o
LINK pnacl/Release/first_unstripped.bc
/nacl/pepper_46/lib/pnacl/Release/libppapi_simple.a: error: undefined reference to 'PSUserMainGet'
make: *** [pnacl/Release/first_unstripped.bc] Error 1
我读了一篇帖子,建议有人用 -Wl,--undefined=PSUserMainGet
的 ldflag
解决了类似的问题...但我想不通了解如何将其正确添加到 makefile 中……如果这甚至是正确的解决方法。我还看到他们的 LIBS
顺序错误...将 SDL2
和 ppapi_simple
放入列表中两次对其他人有效。尽管它们都是旧帖子,但我尝试过的都没有用(并不是说我一定试对了)
我迷路了...任何帮助将不胜感激。
谢谢
最佳答案
好吧,我找到了一些帮助我最终弄明白的资源......
因此,在完成 webports 交易以正确安装 SDL 之后,我继续寻找要使用的正确 makefile。
终于在gituhub上找到一个:https://github.com/emscripten-ports/SDL2/blob/master/test/nacl/Makefile (它看起来与普通的 nacl makefile 有很大不同!)
在此处描述要执行的操作:https://github.com/emscripten-ports/SDL2/blob/master/docs/README-nacl.md
我唯一需要做的另一件事是将此函数添加到我的 C++ 代码中:
int SDL_main(int argc, char *argv[]){
return 0;
}
至少可以说,我的代码现在可以编译了!立即崩溃,但可以编译!
如果我发现遗漏了一些有用的东西,我会发布更多内容
关于c++ - Google 的 Native Client 和编译 SDL2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34280420/
我遇到了一个错误,我不知道如何解决。我有以下代码(来自 Eliom Graffiti 教程),我正在尝试使用 make test.byte 进行测试。 open Eliom_content.Html5
我阅读文档的理解是这样的: 客户端是测试用例的子类。当我们运行 manage.py test 时,会为每个以“test_”开头的方法创建一个 SimpleTest 类的实例(它继承自 TestCase
我已经编写了一个用于接收多个客户端的服务器,它可以分别与客户端通信。在这里,我可以列出服务器中已连接的客户端,但是当客户端断开连接时,它不会从服务器中删除客户端。 Server.py import s
我正在制作一个社交网站。当任何用户在站点上更新或创建新内容时,我需要查看站点的任何其他用户来查看更改更新。 我有一些需要低延迟的评论,因此建议为此订阅。 我也有事件,但这些不需要这么低的延迟。每 10
我想在突变后使用乐观 UI 更新:https://www.apollographql.com/docs/react/basics/mutations.html 我对“乐观响应”和“更新”之间的关系感到
我想了解 Dask 在本地机器上的使用模式。 具体而言, 我有一个适合内存的数据集 我想做一些 pandas 操作 分组依据... 日期解析 等等 Pandas 通过单核执行这些操作,这些操作对我来说
我使用 Apollo、React 和 Graphcool。我有一个查询来获取登录的用户 ID: const LoginServerQuery = gql` query LoginServerQ
在本指南的帮助下,我最近在几个设备的应用程序中设置了 P2P 通信:http://developer.android.com/training/connect-devices-wirelessly/n
注意:我在节点项目中使用@twilio/conversations 1.1.0 版。我正在从使用可编程聊天过渡到对话。 我看到对 Client.getConversationByUniqueName
我对服务客户端和设备客户端库有点困惑。谁能解答我对此的疑问。 问题:当我通过 deviceClient 发送数据时,我无法接收数据,但当我使用服务客户端发送数据时,相同的代码可以工作。现在,xamar
我对服务客户端和设备客户端库有点困惑。谁能解答我对此的疑问。 问题:当我通过 deviceClient 发送数据时,我无法接收数据,但当我使用服务客户端发送数据时,相同的代码可以工作。现在,xamar
假设我有一个简单的应用程序。 如何设置 OAuth2 以允许其他应用程序访问我的应用程序的某些部分。 例如,当开发人员想要使用 Facebook API 时,他们会使用 Facebook API 用户
我有两个模块: 在一个模块中,我从另一个模块run 中引用了一个函数: @myorg/server import { Client } from '.' import { Middleware } f
我在通过服务器从客户端向客户端发送数据时遇到了一些问题(以避免监听客户端上的端口)。 我有一个这样的服务器: var net = require("net"); var server = net.cr
我正在使用 django.test.client.Client 来测试用户登录时是否显示某些文本。但是,我的 Client 对象似乎并没有让我保持登录状态。 如果使用 Firefox 手动完成,则此测
有两个我制作的程序无法运行。有服务器和客户端。服务器通过给用户一个 ID(从 0 开始)来接受许多客户端。服务器根据服务器的 ID 将命令发送到特定的客户端。 (示例:200 个客户端连接到 1 个服
今天,我在 Windows 10 的“程序和功能”列表中看到了 2 个不同版本的 ARC,因此我选择卸载旧版本,因为我需要一些空间。在卸载结束时,它们都消失了! 所以,我从 https://insta
在每个新的客户端连接上 fork 服务器进程 不同的进程(服务器的其他子进程,即 exec)无法识别在 fork 子进程中使用相同 fd 的客户端。 如何在其他进程上区分客户端? 如果文件描述符为新
a和b有什么区别? >>> import boto3 >>> a = boto3.Session().client("s3") >>> b = boto3.client("s3") >>> a ==
a和b有什么区别? >>> import boto3 >>> a = boto3.Session().client("s3") >>> b = boto3.client("s3") >>> a ==
我是一名优秀的程序员,十分优秀!