您如何在Geany中编译/构建/执行C ++项目? [英] How do you compile/build/execute a C++ project in Geany?

查看:1064
本文介绍了您如何在Geany中编译/构建/执行C ++项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的不认为这会很困难. Geany显然具有创建项目,向项目添加文件,编译单个文件的能力,但是即使在谷歌搜索之后,我也找不到关于如何构建和执行项目的清晰描述……这很烦人,因为我真的例如Geany的简单性及其干净整洁的工作空间,但这可能会破坏交易.

I really didn't think it would be this difficult. Geany clearly has the ability to create projects, add files to the projects, compile the individual files, but then even after googling it I could not find a clear description of how to build and execute the project... It's pretty annoying because I really like the simplicity of Geany and its clean, uncluttered workspace, but this could be a deal breaker.

推荐答案

Geany不会编译项目.您可以使用makefile来达到相同的目的.但是,您必须手动创建它,或者使用可以确定依赖关系的外部命令. Geany的"make"命令默认情况下将使用名为"makefile"的make文件,因此您只需为您的make文件指定名称,一切都应该很好.

Geany doesn't compile projects. You can use a makefile to serve the same purpose; however, you have to make it manually or use an external command that can figure out dependencies. Geany's "make" command will use the make file called "makefile" by default, so you can simply give your make file that name and all should be well.

all: hello

hello: main.o factorial.o hello.o
    g++ main.o factorial.o hello.o -o hello

main.o: main.cpp
    g++ -c main.cpp

factorial.o: factorial.cpp
    g++ -c factorial.cpp

hello.o: hello.cpp
    g++ -c hello.cpp

clean:
    rm -rf *o hello

示例摘自此处.您也可以在该页面上找到更多详细信息.

Example taken from here. You can find more detailed information on that page as well.

这篇关于您如何在Geany中编译/构建/执行C ++项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆