Linux 如何从外部代码和 Makefile 启动 Codeblocks 项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13517938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to start a Codeblocks project from external code and Makefile?
提问by Dnaiel
I have C++ code that depends on boost and other libraries, and therefore this code has a makefile that invokes boost.
我有依赖于 boost 和其他库的 C++ 代码,因此这段代码有一个调用 boost 的 makefile。
I am now trying to start developing this code in codeblocks in linux, so in order to do that I have two basic questions:
我现在试图开始在 linux 的代码块中开发这段代码,所以为了做到这一点,我有两个基本问题:
(1) How can I import the code into codeblocks as a codeblocks new project? This seems to be a good rec: http://www.programmingforums.org/thread44976.html
(1) 如何将代码作为codeblocks新项目导入codeblocks?这似乎是一个很好的推荐:http: //www.programmingforums.org/thread44976.html
(2) How do I invoke the makefile with codeblocks instead of codeblocks trying to compile the code (which it would fail since codeblocks does not know that it needs to invoke boost).
(2) 我如何使用代码块而不是代码块来调用 makefile 来尝试编译代码(它会失败,因为代码块不知道它需要调用 boost)。
采纳答案by Luka Rahne
Most projects can be compiled without makefile, so just include files, and if you need extra library include that in project. If your project uses header only boost librarys and you have packet installed libboost-dev (this is on my debian) then it is included automaticaly. Else just use proper library name in settings (I cant remeber if you need to append l to name).
大多数项目可以在没有 makefile 的情况下编译,因此只需包含文件,如果您需要额外的库,请将其包含在项目中。如果您的项目仅使用头文件 boost 库并且您安装了数据包 libboost-dev(这是在我的 debian 上),那么它会自动包含在内。否则只需在设置中使用正确的库名称(我不记得是否需要将 l 附加到名称)。