You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

头文件中定义类引发编译错误求助

头文件中定义类引发编译错误求助

我正在vec3.h头文件里实现vec3类,之后在color.h文件中使用这个类,但编译代码的时候出现了完全摸不着头脑的错误,想请大家帮忙排查问题!

相关代码文件

first_image.cpp

#include "vec3.h"
#include "color.h"

#include<iostream>
#define max_val 255
#define length 255
int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0);
    int image_width = length;
    int image_height = length;
    std::cout <<"P3\n" << image_width <<' '<<image_height<<"\n" << max_val<<"\n";
    for(int i = 0; i < image_height; ++i)
    {       
        for(int j = 0; j < image_width; ++j)
        {
           auto pixel_color = color(double(i)/(image_width - 1), double(j)/(image_height-1), 0);
           write_color(std::cout,pixel_color);
        }
    }
    std::clog << "\rDone                                          \n";
}

vec3.h

注:该文件内容未完整提供,仅能看到开头为#include ...的部分

备注:内容来源于stack exchange,提问作者gunslinger

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 12:39:33