Eclipse CDT中用于播放器/舞台模拟器的代码构建错误

问题描述 投票:0回答:1

我正在使用播放器/舞台进行论文工作。但是,当我想在Eclipse CDT中构建此代码时,我收到未定义的引用错误消息

#include <iostream>
#include <playerc++.h>
#include <playerclient.h>
#include <clientproxy.h>
using namespace std;

int main()
{
PlayerClient robot("localhost",6665);
return 0;
}

错误消息是:

08:40:02 **** Build of configuration Debug for project firstTest ****
make all
Building file: ../src/firstTest.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/player-3.0/libplayerc++ -include/usr/local/include/player-3.0/libplayerc++/playerc++.h -include/usr/local/include/player-3.0/libplayerc++/clientproxy.h -include/usr/local/include/player-3.0/libplayerc++/playerc++config.h -include/usr/local/include/player-3.0/libplayerc++/playerclient.h -include/usr/local/include/player-3.0/libplayerc++/playererror.h -include/usr/local/include/player-3.0/libplayerc++/utility.h -O0 -g3 -Wall -c -fmessage-length=0 `pkg-config --cflags playerc++` -MMD -MP -MF"src/firstTest.d" -MT"src/firstTest.d" -o "src/firstTest.o" "../src/firstTest.cpp"
Finished building: ../src/firstTest.cpp
Building target: firstTest
Invoking: GCC C++ Linker
g++ `pkg-config --libs playerc++` -o "firstTest" ./src/firstTest.o
./src/firstTest.o: In function `main':
/home/nafees/workspace/firstTest/Debug/../src/firstTest.cpp:19: undefined reference to `PlayerCc::PlayerClient::PlayerClient(std::string, unsigned int, int)'
/home/nafees/workspace/firstTest/Debug/../src/firstTest.cpp:19: undefined reference to `PlayerCc::PlayerClient::~PlayerClient()'
collect2: error: ld returned 1 exit status
make: *** [firstTest] Error 1

08:40:02 Build Finished (took 514ms)

我已经按照Jenny-http://yorkroboticist.blogspot.com/2010/03/playerstage-on-eclipse.html发布的这个很好的教程了

在此链接中,您将获得我的Eclipse项目属性的快照:https://www.dropbox.com/sh/9hcmditufu0lt6v/AAChqD1-FMM9FhvTWpuOGMQ-a?dl=0

我已经尝试了很多方法来消除此错误。但是,一切都在静脉中。请帮我继续我的论文。

感谢Nafees

c++ eclipse-cdt simulator player-stage
1个回答
0
投票

我已经找到了“未定义的引用”问题.....

如果有人想使用eclipse CDT进行舞台/播放器模拟,请按照以下步骤操作。我假设您已正确安装了播放器/舞台。

  1. 转到项目属性。
  2. 展开C / C ++ Build。
  3. 单击“设置”。
  4. 如果要构建C ++代码,请按照以下步骤操作 - 在GCC C ++编译器下,单击Miscellaneous选项卡。 有一个名为“其他标志”的框。将此行(带有符号)粘贴在盒子上 - `pkg-config --cflags playerc ++` 警告:切勿编辑框中的现有行。只需将带有空格的现有行旁边的上一行粘贴即可。并牢记'和'是不一样的。 然后,转到includes /目录(名称可能因eclipse版本而异)选项卡。有一个“包含路径(-I)”框。单击添加按钮并导航到 - 计算机> usr>本地>包含> Player- x.x并按确定。
  5. 如果您想构建C代码,请跳过4号指令并按照以下步骤 - 在GCC C Compiler下,单击Miscellaneous。 有一个名为“其他标志”的框。将此行(带有符号)粘贴在盒子上 - `pkg-config --cflags playerc` 警告:切勿编辑框中的现有行。只需将上面一行粘贴到现有的一行旁边即可。并牢记'和'是不一样的 转到包含/目录(名称可能因eclipse版本而异)选项卡。有一个“包含路径(-I)”框。单击添加按钮并导航到 - 计算机> usr>本地>包含> Player- x.x并按确定。
  6. 现在,最重要的步骤来到这里。在GCC C ++ Linker下,单击Miscellaneous选项卡。有一个名为“链接器标志”的框。 如果您使用的是C ++,请粘贴以下行 - `pkg-config --libs playerc ++` 如果您使用的是C,请粘贴以下行而不是上述行 - `pkg-config --libs playerc` 现在,转到Libraries选项卡,在那里您将看到“Libraries(-l)”框。按添加按钮和 如果您使用的是C ++,请粘贴该行 - playerc ++ 如果您使用的是C,请粘贴以下行而不是上述行 - playerc 最后,下面有一个名为“Library search path(-L)”的框。单击“添加”按钮并导航到“计算机”>“usr”>“local”>“lib”,然后单击“确定”。

多数民众赞成.......现在尝试编译并构建一个示例代码。 :) :) :) :)

© www.soinside.com 2019 - 2024. All rights reserved.