简体   繁体   English

在Code :: Blocks项目中更新Box2D- <Box2D/Box2D cannot be found>

[英]Updating Box2D In Code::Blocks Project - <Box2D/Box2D cannot be found>

I am trying to update a year-old project for the latest version of Code::Blocks and the MinGW GNU Compiler. 我正在尝试为一个古老的项目更新Code :: Blocks和MinGW GNU编译器的最新版本。 I am pretty new to working with libraries, so a noob answer would be much appreciated! 我对使用库很陌生,所以一个新手的答案将不胜感激!

The project uses .a library files from Box2D. 该项目使用Box2D中的.a库文件。 From my understanding, in order to update the project I need to build the latest version of Box2D which will generate the needed .a files and use those to replace the old project files. 根据我的理解,为了更新项目,我需要构建Box2D的最新版本,该版本将生成所需的.a文件,并使用这些文件替换旧的项目文件。 I downloaded the latest Box2D build from here and extracted it to a location outside of the main project. 我从此处下载了最新的Box2D构建,并将其提取到主项目之外的位置。 When I try to build the "HelloWorld.cpp" application, I get the error: fatal error: Box2D/Box2D.h: No such file or directory 当我尝试构建“ HelloWorld.cpp”应用程序时,出现错误:致命错误:Box2D / Box2D.h:没有此类文件或目录

The file is definitely there, so I think I need to update my project dependencies, but I'm not sure the proper way to do this. 该文件肯定存在,所以我认为我需要更新项目依赖项,但是我不确定执行此操作的正确方法。 This link helped a bit, but I have no experience with cmake or how to properly install it. 该链接有所帮助,但是我对cmake或如何正确安装它没有任何经验。

Do I just need to fix this dependency error (and how?), or is there a better way to get the new .a files from the latest Box2D source? 我是否只需要解决此依赖性错误(以及如何解决),还是有更好的方法从最新的Box2D源获取新的.a文件? Thanks for any help! 谢谢你的帮助!

EDIT - I am using Windows 7 64-bit. 编辑-我正在使用Windows 7 64位。 I believe the original project was made on the same OS a year ago. 我相信原始项目是在一年前在同一操作系统上完成的。

EDIT2 - Just to make it more clear, the project that Box2D is being used for is for a computer application, not an Andriod or IOS app. EDIT2-为了更清楚一点,Box2D用于的项目是计算机应用程序,而不是Andriod或IOS应用程序。

Easiest way to solve your problem is install box2d into system. 解决问题的最简单方法是将box2d安装到系统中。 To do this, copy 'Box2D' directory, which contains headers into C:/MinGW/include, and box2d *.lib (or *.a) file into C:/MinGW/lib. 为此,将包含标题的Box2D目录复制到C:/ MinGW / include,将box2d * .lib(或* .a)文件复制到C:/ MinGW / lib。 "C:/MinGW" is path, where you installed the MinGW. “ C:/ MinGW”是安装MinGW的路径。

ps I can mismatch names of directories, it was many time ago when I working with this. ps我可以使目录名称不匹配,这是很多年前使用此功能的时间。

This happened to me to. 这发生在我身上。 Did you check if the folder usr/include/Box2d exists? 您是否检查文件夹usr / include / Box2d是否存在?

Somehow mine wasn't there, and I fixed it by typing 不知何故我不在那儿,我通过输入内容进行了修复

sudo apt-get install libbox2d-dev

and installing it again. 并再次安装。

Hope this helps someone. 希望这对某人有帮助。 bye! 再见!

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

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