简体   繁体   English

无法使用JACK API编译源

[英]Fail to compile source with JACK API

For reference: i am currently on Manjaro (Arch Linux) and am using the GNU g++ compiler. 供参考:我目前在Manjaro(Arch Linux)上,并且正在使用GNU g ++编译器。 I want to create a program for JACK (Jack Audio Connection Kit) and am now trying to use their API provided here . 我想为JACK (Jack音频连接套件)创建一个程序,现在正尝试使用此处提供的API。 I have Jack2 installed, but also tried it with Jack2-dbus. 我已经安装了Jack2,但是也尝试过使用Jack2-dbus。 I found something in the AUR called jackcpp, but that didn't help neither. 我在AUR中找到了一个叫做jackcpp的东西,但这都没有帮助。

To get to my problem: I fail to compile their example clients listed, and obviously I fail to build my own using that API. 要解决我的问题:我无法编译列出的示例客户端 ,并且显然我无法使用该API构建自己的示例客户端 I suspect it is broken, but I can't imagine noone reporting it so I don't really know what to do now. 我怀疑它已损坏,但是我无法想象没有人报告它,所以我真的不知道现在该怎么办。

In my jacktest.cpp the following is written: 在我的jacktest.cpp文件中写了以下内容:

#include <iostream>
#include "jack/control.h"

int main(){
    jackctl_server_t *server;
    jackctl_driver_t *driver;

    if (jackctl_server_start(server, driver)) {
        std::cout << "Started!";
        return 0;
    }else{
        std::cout <<"Failed!";
        return 1;
    };
}

based on the function documented here . 基于此处记录的功能。 Try to start a jack server and return a bool if operation successful or not. 如果操作成功或失败,请尝试启动插孔服务器并返回布尔值。 If I try to compile this (with 'pkg-config' as I am supposed to): 如果我尝试编译这种(与“pkg配置”,因为我认为于):

$ g++ -o jacktest `pkg-config --cflags --libs jack` jacktest.cpp

it throws: 它抛出:

jacktest.cpp:8:44: error: too many arguments to function 'bool jackctl_server_start(jackctl_server_t*)'
     if (jackctl_server_start(server, driver))

So I checked and indeed, in my /usr/include/jack/control.h, it defines jackctl_server_start with only one argument. 因此,我检查了一下,实际上,在我的/usr/include/jack/control.h中,它仅使用一个参数定义了jackctl_server_start。 I don't know if their documentation is outdated or if I am missing files/have the wrong ones... Then I tried to do it with only one argument 我不知道他们的文档是否过时,或者我是否缺少文件/文件有误...然后我尝试仅使用一个参数

...    
if (jackctl_server_start(server)) {
...

which then throws: 然后抛出:

/usr/bin/ld: /tmp/ccxm3fWC.o: undefined reference to symbol '_ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4'
/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I tried to rearrange the arguments: 我试图重新排列参数:

$ g++ -o jacktest `pkg-config --cflags --libs jack` jacktest.cpp
$ g++ -o jacktest jacktest.cpp `pkg-config --cflags --libs jack`
$ g++ jacktest.cpp `pkg-config --cflags --libs jack` -o jacktest
$ g++  jacktest.cpp -o jacktest `pkg-config --cflags --libs jack`

which always throws the same error... 总是抛出相同的错误...

now the thing that really makes me think something is broken: another jacktest_2.cpp now including jack.h and excluding control.h 现在,真正让我觉得有些问题的东西:另一个jacktest_2.cpp现在包括jack.h,但不包括control.h

#include <iostream>
#include "jack/jack.h"

int main(){
    jack_client_t *client;

    if (client = jack_client_new("test_client")) {
        std::cout << "Running!";
        return 0;
    }else{
        std::cout <<"Not Running!";
        return 1;
    };
}

which I CAN compile: 我可以编译:

$ g++ -o jacktest_2 jacktest_2.cpp `pkg-config --cflags --libs jack`

altough it gives me complains that this function is depricated, the program does what it should too! 尽管它使我抱怨此函数不完整,但程序也应做! So at least some of it is working?! 所以至少其中一些有效吗?

Also: 也:

$ g++ -print-file-name=jack 
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/jack

is that normal? 那正常吗? There is no lib/jack in usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1 usr / lib / gcc / x86_64-pc-linux-gnu / 7.2.1中没有lib / jack

To conclude: I really NEED control.h, I even went as far as changing control.h and include their 'driver' part from the API Docs back into the function, but that didn't get me anywhere neither... (undefined reference...) I feel like I am missing something really simple, or something really is broken with that API. 总结一下:我确实需要control.h,我什至更需要更改control.h并将其API文档中的“驱动程序”部分重新包含到函数中,但这并没有使我到处都没有...(未定义参考...)我感觉好像缺少了一些非常简单的东西,或者该API确实破坏了一些东西。 I have been on this for almost a week, and I just can't figure it out. 我已经进行了将近一个星期,但我只是想不通。

If anyone stumbles upon this and wondered what happend: I posted this in the JackAudio forum here . 如果有人绊倒在此,不知道发生了什么:我张贴这在JackAudio论坛在这里 Anyone can read it if he/she wants to, but I will mark this question as answered now, since it really is not a C++ or compiling problem but rather a Jack problem. 任何人都可以阅读它,但我现在将此问题标记为已回答,因为它实际上不是C ++或编译问题,而是Jack问题。 Thank you! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM