简体   繁体   English

Codenvy C ++ Hello World程序无法构建?

[英]Codenvy C++ Hello World program won't build?

I am starting to try and use an online IDE, so I started with Codenvy. 我开始尝试使用在线IDE,因此我从Codenvy开始。 I created a workspace and a project and I typed in the following code for a Hello World program just to test the IDE. 我创建了一个工作区和一个项目,然后为Hello World程序输入了以下代码,仅用于测试IDE。

#include <iostream>

int main () {
    std::cout << "Hello World!" << std::endl;
    return 0;
}

It didn't build correctly. 它没有正确构建。 This is what the build log says: 这是构建日志的内容:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /projects/Testing-CPP/pom.xml: /projects/Testing-CPP/pom.xml (No such file or directory) @ 
@ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project  (/projects/Testing-CPP/pom.xml) has 1 error
[ERROR]     Non-readable POM /projects/Testing-CPP/pom.xml: /projects/Testing-CPP/pom.xml (No such file or directory)
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

Can anyone point me in the right direction to getting the IDE to build and run my code? 谁能为我指出正确的方向,以使IDE生成并运行我的代码?

Your code is all right, so that means there is something wrong with the way you have set up your project, as the error message specifies: 您的代码没问题,这意味着您设置项目的方式有问题,因为错误消息指出:

The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project  (/projects/Testing-CPP/pom.xml) has 1 error
[ERROR]     Non-readable POM /projects/Testing-CPP/pom.xml: /projects/Testing-CPP/pom.xml (No such file or directory)

The following link provides a tutorial on how to make your first Hello World program on CodeEnvy: 以下链接提供了有关如何在CodeEnvy上制作第一个Hello World程序的教程:

Running C++ Hello World in the Cloud - Blog 在云中运行C ++ Hello World-博客

Go over the insuctions provided; 仔细检查所提供的约束; if there is anything they did that you didn't, then that is probably where you went wrong. 如果他们做了您没有做过的事情,那可能就是您做错了。

Good luck! 祝好运!

It looks like you have your project setup as Java/Maven type so it's looking for a pom.xml and probably trying to run mvn clean install . 看来您已将项目设置为Java / Maven类型,因此它正在寻找pom.xml并可能尝试运行mvn clean install

Project typing is one of the powerful paradigms in Codenvy and Eclipse Che - it allows projects with specific "types" to assume certain behaviors and auto-setup certain things in the environment. 项目类型是Codenvy和Eclipse Che中强大的范式之一-它允许具有特定“类型”的项目在环境中承担某些行为并自动设置某些东西。 So a Java Maven typed app knows that maven must be installed and can auto-add a build command for mvn clean install since that will work with nearly every Maven app. 因此,Java Maven类型的应用程序知道必须安装maven,并且可以为mvn clean install自动添加构建命令,因为该命令几乎可以与所有Maven应用程序一起使用。

Try starting with a clean workspace based on the Codenvy C++ stack and the console-cpp-simple sample application. 尝试从基于Codenvy C ++堆栈和console-cpp-simple示例应用程序的干净工作空间开始。 When you get in the workspace you'll see you have a build command that executes a gcc command. 当您进入工作区时,您会看到一个执行gcc命令的build命令。

Then you can import your project from inside the IDE by going to Workspace > Import Project. 然后,可以通过转到Workspace> Import Project从IDE内部导入项目。 You can then copy the build command from the sample app and (if necessary) modify it for your app. 然后,您可以从示例应用程序中复制构建命令,并(如有必要)为您的应用程序对其进行修改。 Once your app compiles you can just deleted the hello world C sample app. 应用编译后,您可以删除hello world C示例应用。

You can also select the project you have now and choose Project > Configuration but that won't necessarily add the right compile command for you. 您也可以选择您现在拥有的项目,然后选择“项目”>“配置”,但这不一定会为您添加正确的编译命令。

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

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