c++gccg++

Do I need to do something special to get my C++ program to compile using gcc?


Why does my program compile nicely with no warnings when I type g++ program_name but when I type gcc program_name I get screenfuls of undefined reference errors...

I am using the standard library quite a bit, here are my includes:

#include<string>
#include<vector>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<algorithm>

using namespace std;

The reason I ask is I spent all this time developing a solution for a codeeval.com challange. It works perfectly when compiled with g++, but won't compile with gcc.

Long story short, when codeeval tries to run my stuff, I get a score of 0 (!) although I have no idea how they are going about testing submissions... They just say: Your program did not pass all the test cases or there may have been warnings printed out at runtime.

Of course, I have no idea how they are compiling it... They do say:

You submissions are executed in a *NIX type environment. Assume softwares/shells etc are in their standard locations. Nothing else.

(since the have a typo in their submission guidlines, might other stuff be up?)

They also say they accept solutions for C++ 4.3.4. I am running cywin and 4.3.4 is the version of my gcc.

Has anyone else ever had a problem with submitting C++ code to codeeval.com?

I'm trying not to be super frustrated, but at this point they seem more like codeevil.com to me...


Solution

  • gcc doesnt link in the standard c++ libraries by default. Either add -lstdc++ to the link line, or just compile with g++.