3

I have a sample program in a file called "helloworld.cpp":

#include <iostream>

using namespace std;
int main(int argc, char** argv)
{  
  cout<<"Hello World!";
  return 0;
}

I am trying to write a makefile for this as follows:

all: g++ helloworld.cpp -o helloworld

Right now I am on windows and couldn't test this. However, when I submit this to one of the site (www.gild.com) it is telling me that submission has failed due to build error. Can somebody point out what is wrong here?

Robot Woods
  • 5,677
  • 2
  • 21
  • 30
user21229
  • 53
  • 1
  • 5
  • Perhaps change the order: `g++ -o helloworld helloworld.cpp` – Thomas Matthews Aug 18 '11 at 19:26
  • Being on Windows doesn't prevent testing these things: both gcc/g++ and GNU make are available on Windows. Install MinGW and MSYS from http://mingw.org, and make sure you have the compiler and MSYS binaries in PATH. – Michael Madsen Aug 18 '11 at 19:41

2 Answers2

5

You have the action to be run on the part of the line where the dependency goes. Try this:

all: 
        g++ helloworld.cpp -o helloworld

Make sure that's one tab, not spaces in any quantity.

Daniel Lyons
  • 22,421
  • 2
  • 50
  • 77
  • Don't know enough about gild to help you more than this. If you made sure that's a tab and not spaces, then it should work. Your code looks correct. Can you give more details from gild or do they just say "submission failed"? – Daniel Lyons Aug 18 '11 at 19:11
1

If your solution only contains one class no makefile is required

http://www.gild.com/challenges/details/code_submission_guidelines?keyword=missile

edit: Also you will want to make sure your folders are organized correctly. This is a good place to start http://community.gild.com/gild/topics/help_me_to_submit_helloworld_solution_in_java