资讯动态

[C语言]《Dev-C++ 报错解决手册(Day0607 精华版)》

发布时间:2026/8/24 12:32:38 来源:尧图企业网站定制
————新手必备从编译错误到运行崩溃一篇搞定前言Dev-C 是许多 C/C 初学者的入门 IDE但其报错信息有时不够直观容易让人一头雾水。本文整理了一些高频错误及其解决方法希望能帮你节省调试时间。错误速查表DeepSeek给的通用报错及解决方案我的报错与解决方案序号问题解决方案1typedef int bool;#define true 1#define false 04 13 D:\桌面\ModelFactory\Implement\Linear_sequentialList.h [Error] two or more data types in declaration specifiers使用已有BOOL三方库#include stdbool.h213 2 D:\桌面\ModelFactory\Implement\Linear_sequentialList.h [Error] unknown type name SqList定义基础类型 int/double/float/bool内存基址311 23 D:\桌面\ModelFactory\Implement\Linear_sequentialList.h [Error] expected ; before typedefC语言行末缺少符号411 3 D:\桌面\ModelFactory\Implement\Linear_sequentialList.c [Error] L is a pointer; did you mean to use -?指针用-指向成员变量57 D:\桌面\ModelFactory\main.c [Error] unterminated #ifdef既然#ifdef #elifdef #endif 不存在那么用#ifdef #endif #ifdef #endif便行69 2 D:\桌面\ModelFactory\main.c [Warning] implicit declaration of function log_info [-Wimplicit-function-declaration]log.h不能被隐式调用#include ./Implement/log.h727 86 D:\桌面\ModelFactory\Implement\Linear_sequentialList.c [Error] ElemTypes undeclared (first use in this function); did you mean ElemType?ElemTypes拼写错误8编译窗口不见了原文链接https://blog.csdn.net/weixin_45846799/article/details/12068578797 13 D:\桌面\ModelFactory\Implement\Linear_LinkList.h [Error] conflicting types for ElemTypemake clean再次执行编译108 13 D:\桌面\ModelFactory\Implement\Linear_LinkList.h [Error] conflicting types for ElemTypetypedef float ElemType_float;typedef int ElemType_int;11D:\桌面\ModelFactory\collect2.exe [Error] ld returned 1 exit statusC:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\x86_64-w64-mingw32\bin\ld.exe Implement/Linear_LinkList.o:Linear_LinkList.c:(.text0x166): multiple definition of PrintList; Implement/Linear_List.o:Linear_List.c:(.text0x268): first defined here改个名字1219 2 D:\桌面\ModelFactory\main.c [Warning] implicit declaration of function Print_LinkList; did you mean PrintList? [-Wimplicit-function-declaration]函数实现忘记更新头文件了1326 30 D:\桌面\ModelFactory\Implement\Linear_LinkList.c [Warning] implicit declaration of function malloc [-Wimplicit-function-declaration]在C语言中使用 malloc 需要包含 stdlib.h 头文件否则编译器会假设 malloc 返回 int 类型隐式声明导致警告和潜在的错误。14指针使用C语言只支持值传递函数内修改参数不影响外部调用后外部指针仍为默认值。所有结果return见证。1514 2 D:\桌面\ModelFactory\include\Stack_LIFO.h [Error] unknown type name ElemType_Staktypedef int ElemType_Stak;拼写错误1611 9 D:\桌面\ModelFactory\include\Stack_LIFO.h [Warning] ISO C99 requires whitespace after the macro name#define STACKINCREMENT 10; //存储空间 分配增量178 9 D:\桌面\ModelFactory\include\Stack_LIFO.c [Warning] implicit declaration of function LOG_ERROR [-Wimplicit-function-declaration]大小写区分18如何获取文件组织CMDls -R# 或者更美观的树形tree /F /F 显示每个文件夹中的文件名/A 使用 ASCII 字符而非图形字符。POWERSHELLGet-ChildItem -Recurse | Select-Object FullName# 或者更美观的树形tree.com /F19C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\x86_64-w64-mingw32\bin\ld.exe Implement/?筛?新?罩?库?跋?有?罩?库?得?/log_auto.o:log_auto.c:(.text0x24a): multiple definition of log_set_level; Implement/log.o:log.c:(.text0x24a): first defined here中文路径从project移除通用排查步骤1. **红色错误看第一行**编译器报错往往一串最上面的才是根本原因。2. **双击报错行**Dev-C 会跳转到大致位置检查前后几行代码。3. **确认编译器设置**工具 → 编译选项 → 勾选“编译时加入以下命令” → 填入 -stdc11若需 C11 特性。4. **清理并重新编译**执行“工具 → 清除历史记录”再重新编译运行。结语遇到报错不用慌大多数都是语法或配置问题。建议将本文提到的几种常见错误保存下来下次遇到时直接对照排查。如果你有其他疑难报错欢迎在评论区留言我们一起完善这份列表。*整理日期Day0607 | 适用 Dev-C 5.11 及以上版本*

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价