我的环境
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
Run Code Online (Sandbox Code Playgroud)
我在我的mac上编译并成功执行了二进制文件,然后将其复制到上面显示go env的ubuntu机器上.当我调用myprog二进制文件时,我得到了
bash: /usr/local/go/bin/myprog: cannot execute binary file: Exec format error
Run Code Online (Sandbox Code Playgroud) 我在cpp中有一个opencv应用程序.
它使用opencv中的简单结构捕获视频流并将其保存到视频文件中.
它与我的网络摄像头完美配合.
但是,它可能在大约十秒后崩溃,而我运行它来捕获来自IP Camara的流.
我的编译命令是:
g++ -O3 IP_Camera_linux.cpp -o IP_Camera `pkg-config --cflags --libs opencv`
Run Code Online (Sandbox Code Playgroud)
来自IP cam的我的流被访问如下:
const string Stream = "rtsp://admin:xxxx@192.168.0.101/";
Run Code Online (Sandbox Code Playgroud)
它运行完美,显示视频并保存,直到显示的视频冻结并且应用程序崩溃.虽然终端上的错误消息是:
[h264 @ 0x15e6f60] error while decoding MB 59 31, bytestream (-20)
[h264 @ 0x15e8200] error while decoding MB 61 27, bytestream (-3)
[h264 @ 0x109c880] missing picture in access unit
[h264 @ 0x109c000] no frame!
Run Code Online (Sandbox Code Playgroud)
根据我的理解,上述错误消息中的第二行可能有一些事情要做,但实际上并没有使应用程序崩溃.最后两行可能是原因还是原因?
有帮助吗?
我正在关注这个例子.但是,我想为给定的玩具示例代码编译静态二进制文件.通常,我-static
在编译期间使用但在此处它给出了错误消息.
编译命令工作正常:
g++ freeimagetest.cpp -o freeimagetest -lfreeimageplus
Run Code Online (Sandbox Code Playgroud)
编译命令不能正常工作:
g++ freeimagetest.cpp -o freeimagetest -lfreeimageplus -static
Run Code Online (Sandbox Code Playgroud)
错误消息的最后几行:
In function `ZIPPreDecode':
(.text+0x6f8): undefined reference to `inflateReset'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfreeimageplus.a(tif_zip.o): In function `ZIPSetupDecode':
(.text+0x783): undefined reference to `inflateInit_'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfreeimageplus.a(tif_zip.o): In function `ZIPSetupDecode':
(.text+0x7b4): undefined reference to `deflateEnd'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
那么如何完成/修复呢?
编辑: 我看不到附加链接如何解决我的问题.显然,它看起来,由于错误消息,我试图静态编译它的方式存在一些问题.我找不到正确的方法.我认为错误信息是错误的 - 它只是以这些行结束(这些行不到所有消息的百分之一).任何做过它的人都可以更好地回答.如果您认为您的答案不仅仅是一个有根据的猜测,我会请求您在回答之前先试一试.如果您按照附件链接,只需几分钟.此外,我也标记了C
因为C语言程序也是如此.
我试图记住C编程的基础知识,关于结构的指针我正在做以下事情:
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main()
{
struct MyStruct {
int number;
char *name;
};
int i;
struct MyStruct *p_struct = (struct MyStruct *) malloc (sizeof(struct MyStruct)*3);
printf("sizeof(struct MyStruct) = %d\n", sizeof(struct MyStruct));
for (i=0; i<3;i++)
{
(*p_struct).number = i;
(*p_struct).name = "string";
printf("(*p_struct).number = %d, (*p_struct).name = %s\n", (*p_struct).number (*p_struct).name);
++p_struct;
}
printf("sizeof(p_struct) = %d\n", sizeof(p_struct));
free (p_struct);
return 1;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:我得到8个字节作为结构的大小,由于编译器的对齐/填充,这可以是4 + 4 = 8个字节,但为什么我从4个字节sizeof(p_struct)
?
我期待得到24(8字节x 3),为什么会这样?
如果这是正确的,我可以以某种方式获得24字节的总分配大小吗?
谢谢.
我想创建一个自定义.sks文件,并在我的spriteKit应用程序中使用它.但我不知道如何创建它.
任何能告诉我如何创建.sks文件的细节的人.
我正在按照命令行中的Data Science安装教程,其中包括以下步骤:
$ mkdir MyDataScienceToolbox
$ cd MyDataScienceToolbox
$ vagrant init data-science-toolbox/data-science-at-the-command-line
$ vagrant up
Run Code Online (Sandbox Code Playgroud)
这完全适用于我的一台计算机而不是另一台计算机.为什么?
两台计算机都使用Virtualbox版本:4.3.12和Windows 7.
这是错误消息:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'data-science-toolbox/data-science-at-the-command-line'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
Run Code Online (Sandbox Code Playgroud)
用于控制VirtualBox.命令和stderr如下所示.
Command: ["import", "C:\\Users\\bernard\\.vagrant.d\\boxes\\data-science-toolbox-VAGRANTSLASH-data-science-at-the-command-line\\0.0.5\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "packer-virtualbox-iso_1410075150030_92186", "--vsys", "0", "--unit", "7", "--disk", "C:\\cygwin64\\home\\bernard\\VirtualBox VMs\\packer-virtualbox-iso_1410075150030_92186\\packer-virtualbox-iso-disk1.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting C:\Users\bernard\.vagrant.d\boxes\data-science-toolbox-VAGRANTSLASH-data-science-at-the-command-line\0.0.5\virtualbox\box.ovf...
OK.
0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Could not …
Run Code Online (Sandbox Code Playgroud) 在此期望脚本中,将没有ssh服务器连接,我只想在本地执行“ .sh”文件,这可能吗?
例如:
#!/bin/expect
command "xxx.sh" # a command which starts a certain shell script
Run Code Online (Sandbox Code Playgroud)
另外,是否可以在期望脚本中执行期望脚本?
例如:
#!/bin/expect
command "xxx.exp" # a command which starts a certain expect script
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?
我想在我的应用程序中使用TouchID,仅在横向模式下.一切正常,但身份验证警报仅在纵向模式下显示.我该怎么办?
这是我的代码:
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = [[NSString alloc] initWithUTF8String: title];
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
NSLog(@"Authenticated using Touch ID.");
//do something
} else {
// User did not authenticate successfully, look at error and take appropriate action
if (authError.code == kLAErrorUserFallback) {
NSLog(@"User tapped Enter Password");
} else if (authError.code == kLAErrorUserCancel) { …
Run Code Online (Sandbox Code Playgroud) 我可以从网络摄像头捕获视频并使用此代码保存
cap = cv2.VideoCapture(0)
fgbg= cv2.BackgroundSubtractorMOG()
fourcc = cv2.cv.CV_FOURCC(*'DIVX')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640,480))
while(cap.isOpened()):
ret,frame = cap.read()
if ret:
fgmask = fgbg.apply(frame)
out.write(frame) #Save it
cv2.imshow('Background Subtraction', fgmask)
if cv2.waitKey(1) & 0xFF == ord('q'):
break #q to quit
else:
break #EOF
cap.release()
out.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
这按照人们的预期记录,并显示背景减法的内容.它将它保存到output.avi.一切都很好.但我无法保存前景蒙版,它给了我一个Could not demultiplex stream
错误.(此行在上面的代码中更改).
out.write(fgmask) #Save it
Run Code Online (Sandbox Code Playgroud)
为什么是这样?当我从捕获中读取时,fgmask不是一个框架吗?
我在论坛上看到了几个关于这个schedule()函数的问题,但我的问题有点不同.我已经看过几个关于它的理论,算法和实现方面的讨论和文献.
不清楚的问题和被问到的问题是执行方面.当然,深入查看内核的源代码并进行所有必需的调试,跟踪bla bla ...可能会回答这个问题,但重新发明轮子似乎并不明智.
问题/困惑如下:
内核级别的多线程用户程序遍历的路径是什么?
谁安排线程?哪个中断上下文?任何名字?(如果我们看到内核级别的跟踪,没有任何称为" sched ",但有交换器,inits,ksoft*bla bla)Deos它是这样的:
其子线程的进程(用户程序)首先由内核占用,然后内核将它们作为可执行线程(通过将它们与schedule()和/或其他函数合并,即,这个新的可执行线程有一些来自内核可能来自schedule()/其他,嵌入了用户任务指令.如果情况发生,它会自动安排)
要么
schedule()总是在某个协处理器上执行,以便在必要时从该协处理器进行观察和操作?这就是为什么,有时当我们看到任何两个线程切换到cpu时,只有交换器在中间和之前和之后执行,即,在该级别没有任何调用调度程序,对吧?
感谢阅读并抱歉写下我的困惑与大家分享.