c++ - 如何在 Eclipse CDT 中设置相应的 GCcflags和环境变量

标签 c++ linux ubuntu-11.10 festival

您好,我一直在尝试让我的一个 C++ 程序在 Linux GCC 上运行 我使用了一个名为 Festival 2.1 的文本转语音库

<code>
#include<iostream>
#include<stdlib.h>
#include<festival/festival.h>

using namespace std;

int main()
{
    int heap_size=210000;
    int load_init_files=1;
    festival_initialize(load_init_files,heap_size);
    festival_say_text("Hi dude, how are you ?");
    festival_wait_for_spooler();
    return 0;
}
</code>

这是我的程序。 g++ test.cpp -l Festival -I/usr/include/festival -I/usr/lib/speech_tools/include -leststring -lestools -lestbase 目录 使用它我能够成功编译并且可以创建 exec。

但是,我如何在 Eclipse CDT(ubuntu 11.10)中设置 env 变量等以使用此代码工作.. 现在我收到错误

/home/gp/WORKSPACE-CDT/LBOT/Debug/../src/test.cpp:21: undefined reference festival_initialize(int, int)' /home/gp/WORKSPACE-CDT/LBOT/Debug/../src/test.cpp:22: undefined reference EST_String::EST_String(char const*)' /home/gp/WORKSPACE-CDT/LBOT/Debug/../src/test.cpp:22: undefined reference festival_say_text(EST_String const&)' /home/gp/WORKSPACE-CDT/LBOT/Debug/../src/test.cpp:23: undefined reference festival_wait_for_spooler()' ./src/test.o: 在函数 EST_Chunk::operator--()' 中: /usr/include/speech_tools/EST_Chunk.h:140: undefined reference EST_Chunk::~EST_Chunk()' /usr/include/speech_tools/EST_Chunk.h:140: 未定义对“EST_Chunk::operator delete(void*)”的引用 collect2: ld 返回 1 退出状态 make: * [LBOT] 错误 1

最佳答案

我找到了解决这个问题的方法。 因此,如果有人在运行 Festival tts 时遇到同样的问题,它会有所帮助 :) 基本上可以通过项目属性和更改工具链设置在 Eclipse 中设置环境标志和变量 脚步: Ubuntu 11.10

预装 GCC 4.x

Elipse CDT 是使用终端命令安装的

在 eclipse 中配置的 pthreads 使用:project->preferences->c/c++ build/settings->GCC linker-> library vars add "pthreads"

Festival 安装使用:sudo apt-get install festival

Festival dev 安装使用:sudo apt-get install festival-dev festvox-don build-essential g++

Unresolved inclusion 错误:转到 eclipse,project->preferences->c/c++ build/settings 并将 festival、speech_tools 路径添加到 c、c++、链接器目录

#include<stdio.h>

#include<festival.h>

int main(int argc,char **argv)

{

int heap_size=210000;

int load_init_files=1;

festival_initialize(load_init_files,heap_size);

festival_say_text("it is lunch time");

festival_wait_for_spooler();

return 0;

}

终端

sudo g++ main.cpp -l Festival -I/usr/include/festival  -I/usr/lib/speech_tools/include -l eststring -l estools -l estbase -o nat.out

eclipse

project->preferences->c/c++ build/settings->GCC linker-> library vars add 'Festival'

project->preferences->c/c++ build/settings->GCC linker-> library vars add 'eststring'

project->preferences->c/c++ build/settings->GCC linker-> library vars add 'estools'

project->preferences->c/c++ build/settings->GCC linker-> library vars add 'estbase'

关于c++ - 如何在 Eclipse CDT 中设置相应的 GCcflags和环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17800543/

相关文章:

c++ - 错误 C2679 : binary '[' : no operator found which takes a right-hand operand of type 'overloaded-function'

C++ 将字符串写入文件开头

javascript - 如何比较两个MySql数据库

MonoDevelop 中的 Java 控制台错误

windows - 如何在 Windows 7 中命令运行 symfony2

c++ - static 和 extern 关键字 LINK 错误 C++

c++ - 为什么 C++17 向命名空间和枚举器添加属性?

linux - Bash 排序忽略前 5 行

linux - 无法连接到 unix :///var/run/docker. sock 上的 Docker 守护进程?

ruby-on-rails - Rails:FATAL - 用户对等身份验证失败(PG::Error)