注册 登录
编程论坛 C++教室

请教下面这个小程序有什么问题,怎么老是显示不能连接啊?

waynell95 发布于 2010-08-16 22:51, 3077 次点击
程序是:
#include <iostream.h>
#include <math.h>

double  max(double x, double y);

void main()
{
    double a, b, c;
    cout <<"input two numbers:\n";
    cin >>a >>b;

    c = max(a,b);
    cout <<"the squart of maximum=" <<sqrt(c);
}

double max(double x, double y)
{
    if(x > y)
        return x;
    else
        return y;
}


编译显示:
-------------- Build: Debug in ch1_3 ---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done.

我使用的是Code::Blocks10.05,难道是编译器没有iostream.h和math.h这样的标准库吗?尝试把在#include后把.h去到,也是不成。请您指点。
2 回复
#2
东海一鱼2010-08-16 23:02
没有问题啊,我用的VC6。
估计可能是你的编译器配置的有问题。找不到库,或没有生成目标文件。
.h是声明文件。库是lib或o文件。你需要在lib路径中设置好他们的位置。


[ 本帖最后由 东海一鱼 于 2010-8-16 23:04 编辑 ]
#3
waynell952010-08-16 23:14
版主好人。请问iostream和math对应的库文件是哪个啊?
1