我是否需要做一些特殊的事情才能让我的C++程序使用gcc进行编译?

Jim*_*mmy 4 c++ gcc g++

为什么我的程序在我输入g++ program_name时没有警告就很好地编译,但是当我键入时,gcc program_name我得到了一些未定义的引用错误...

我使用标准库很多,这里是我的包括:

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

using namespace std;
Run Code Online (Sandbox Code Playgroud)

我问的原因是我花了这么多时间为codeeval.com挑战开发一个解决方案.它在使用g ++编译时非常有效,但不能用gcc编译.

长话短说,当codeeval尝试运行我的东西时,我得到0(!)的分数,虽然我不知道他们如何测试提交...他们只是说:Your program did not pass all the test cases or there may have been warnings printed out at runtime.

当然,我不知道他们是如何编译的......他们说:

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

(因为他们的提交指南中有拼写错误,其他东西可能会出现吗?)

他们还说他们接受C++ 4.3.4的解决方案.我正在运行cywin,4.3.4是我的gcc的版本.

有没有其他人在向codeeval.com提交C++代码时遇到过问题?

我试着不要太沮丧,但在这一点上他们看起来更像是codeevil.com给我...

Mic*_*son 5

默认情况下,gcc在标准c ++库中没有链接.将-lstdc ++添加到链接行,或者只使用g ++编译.