C语言 GCC“构建文件:没有项目中没有目标”的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38573095/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 10:27:10  来源:igfitidea点击:

Problems with GCC "build file: no target in no project"

ccodeblocks

提问by Arturo

I have a problem with C. When I want to compile my sources codes, I see the message:

我的 C 有问题。当我想编译我的源代码时,我看到以下消息:

=== Build file: "no target" in "no project" (compiler: unknown) ===

The classic Hello world works, but I have this message.

经典的 Hello world 有效,但我收到了这条消息。

enter image description here

在此处输入图片说明

I want to make a program that read all absolute directories and subdirectories recursively, print all names with 252 characters or more in a file. I use codeblocks and GNU gcc.

我想制作一个递归读取所有绝对目录和子目录的程序,打印文件中包含 252 个或更多字符的所有名称。我使用代码块和 GNU gcc。

enter image description here

在此处输入图片说明

回答by Vityata

I have just had this problem with Codeblocks. Although I had a compiler.

我刚刚遇到了 Codeblocks 的这个问题。虽然我有一个编译器。

The problem was that I have not saved the file with the correct extension - e.g. it was Untitled4in stead of Untitled4.cor Untitled4.cpp(for c++). Simply renaming the file has worked.

问题是我没有用正确的扩展名保存文件 - 例如它Untitled4代替了Untitled4.cor Untitled4.cpp(对于 C++)。只需重命名文件即可。

回答by Laura

I just had this problem too but I managed to get it going. I had to go to New --> Project --> Console Application.

我也遇到了这个问题,但我设法解决了。我不得不去新建 --> 项目 --> 控制台应用程序。

My guess is that an update has changed functionality or something. I distinctly remember that I could just simply add a new Empty File and then be able to debug and it run from there. Apparently not anymore. I now specifically have to go to the add new projects option and then choose the console application.

我的猜测是更新改变了功能或其他东西。我清楚地记得我可以简单地添加一个新的空文件,然后能够调试并从那里运行。显然没有了。我现在必须转到添加新项目选项,然后选择控制台应用程序。

Don't forget to choose the C compiler and not C++ compiler when it walks you through the process.

在指导您完成整个过程时,不要忘记选择 C ​​编译器而不是 C++ 编译器。

回答by Gaurav Sahu

I have encountered the same problem. So i found that i do have created a project file, but my files(.cpp, .h and other) files were not included in my project, to check that open your codeblock ide-> open your project-> and on the left hand side you will see a Management tab, which should contain all your file( if you are not able to see Management tab, just follow step: go to view panel )

我遇到了同样的问题。所以我发现我确实创建了一个项目文件,但是我的文件(.cpp、.h 和其他)文件没有包含在我的项目中,以检查是否打开您的代码块 ide-> 打开您的项目-> 并在左侧手边你会看到一个管理选项卡,它应该包含你的所有文件(如果你看不到管理选项卡,只需按照步骤:转到查看面板)

回答by Murilo Fujita

While the process is active, you can′t run the program.
Open the Task Managerand kill the process created by CodeBlocks (the same name of your project).

当进程处于活动状态时,您无法运行该程序。
打开任务管理器并杀死由 CodeBlocks 创建的进程(与您的项目同名)。

回答by Mostafa Na

Just create a new project and Copy and paste your texts into the new files. It will work.

只需创建一个新项目并将您的文本复制并粘贴到新文件中即可。它会起作用。