nmgxlms 2017-01-31 12:57 采纳率: 0%
浏览 1585

将sublime text 3作为c++ ide 时候,分开的.c与.h无法运行

小弟的电脑是低配surface,跑vs无奈实在是卡,于是试图用sublime解决问题
按照网上配置,安装了gcc,配置了环境变量,单独构造了编译系统
新建了一个.cpp文件,print hello world,ctrl+b出现cmd窗口,成功输出
然后就找了一个自己之前写的小项目测试
这个项目是分开在了6个文件里三个.cpp三个.h
在main.cpp里面可以正常的看到其他文件中各个类和函数的信息
所以可以确认文件之间的链接关系正常
但是问题来了,在main.cpp里面用ctrl+b编译并运行时
只会在sublime的窗口里面提示finish in xxx s,也不会出cmd窗口

换回单独的.cpp文件再次测试hello world ,一切正常
求教这是哪里出了问题?

  • 写回答

4条回答 默认 最新

  • nmgxlms 2017-01-31 13:05
    关注

    贴一下显示的错误信息
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x29): undefined reference to CSPoint::CSPoint(double, double)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x4d): undefined reference to
    CSPoint::CSPoint(double, double)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x61): undefined reference to CSPoint::CSPoint(double, double)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x96): undefined reference to
    operator>>(std::istream&, CSPoint&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0xbb): undefined reference to operator<<(std::ostream&, CSPoint&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0xdd): undefined reference to
    operator<<(std::ostream&, CSPoint&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x131): undefined reference to CSline::CSline(double, double, double, double)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x148): undefined reference to
    CSline::CSline(CSPoint&, CSPoint&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x166): undefined reference to CSline::display()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x188): undefined reference to
    operator<<(std::ostream&, CSline&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x19b): undefined reference to CSline::ifin(CSPoint&)'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x1f1): undefined reference to
    CSline::~CSline()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x1fc): undefined reference to CSline::~CSline()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x208): undefined reference to
    CSPoint::~CSPoint()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x214): undefined reference to CSPoint::~CSPoint()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x223): undefined reference to
    CSPoint::~CSPoint()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x239): undefined reference to CSline::~CSline()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x249): undefined reference to
    CSline::~CSline()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x25a): undefined reference to CSPoint::~CSPoint()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x26b): undefined reference to
    CSPoint::~CSPoint()'
    C:\Users\nmgxlms\AppData\Local\Temp\cc6b5Ils.o:main.cpp:(.text+0x27f): undefined reference to `CSPoint::~CSPoint()'

    评论

报告相同问题?

悬赏问题

  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?