事例:本来想在fileA.c中调用另外一个文件fileB.c中的函数printmessage,为了明确这种调用与被调用的关系,于是我就在fileA.c中通过#include把fileB.c文件包含进来,但是编译的时候fileB.c中报:
Multiple markers at this line
-syntax error before "..."
-Syntax error
后来在fileA.c中把#include "fileB.c"语句去掉,编译通过
fileA.c
=================================
#include <stdio.h>
#include <stdlib.h>
/*因为调用fileB.c中的printmessage函数,本想把它包含进来,但会报:multiple markers at this line错误,注释后编译通过*/
//#include "fileB.c"
/* printmessage函数在fileB.c中已声明,在fileA.c中还要声明,否则报:implicit declaration of function "printmessage"*/
void printmessage();
void ghellops();
void ghellops() {
printmessage(); //调用
printf("fold aaa.c\n");
}
fileB.c
=================================
#include <stdio.h>
#include <stdlib.h>
void printmessage();
void printmessage() {
printf("fileB.c printmessage\n");
}
以上例子在IDE:
eclipse for c/c++ developers, Version: 3.4.2
Compiler:
MinGW-5.1.4
中调试成功。由于不同平台之间的标准不一样,所以在其它平台比如Dev++, VC可能会有其它问题。
开发环境的搭建请参考:
http://justshare.iteye.com/blog/403104
http://snowolf.iteye.com/blog/401198
还有一个事项非常重要,由于C语言是面向过程的,它没有对象的概念,各个文件之间调用与被调用靠函数来关联,所以
在C工程里是不可以有相同的函数名的,即在一个C工程中所有的函数名都要确保唯一(这项规则还是问过我的一个开发C的同学之后才明白的,在这之前我怎么也想不明白。唉,还是面向对象的思想在作祟啊)。
注:由于一直做JAVA开发,保留了很多面向对象的习惯,突然之间转向C,很不适应呐!
分享到:
相关推荐
使用Eclipse 进行项目开发,在实现类中的方法前面如果添加@Override就提示“Multiple markers at this line”的错误,问题
用于初学着 对错误提示的解释理解 提高学习速度 还还学习吧 希望对你有帮助
用QML编写的一个学习实例,可以打开文本文件或图片等格式的文件。hello world
配置dubbo协议时,报错。缺少dubbo.xsd文件。别人要5积分,我这给你们更低的,只为支持开发工作者。
react使用高德地图react-amap:Map、Markers、Circle、ContextMenu、自定义ContextMenu
Diagnosing CAD: additional markers from myocardial perfusion SPECT.pdf
python库。 资源全名:dephell_markers-1.0.1.tar.gz
接受与 LINE 命令相同的输入,附加参数 NUM_MARKERS,指定要绘制的标记数量。 受到 Ioannis Filippidis 的第一个回答的启发http://www.mathworks.com/matlabcentral/answers/2165-too-many-markers
Leaflet.Canvas-Markers-0.2.0 https://github.com/corg/Leaflet.Canvas-Markers
资源来自pypi官网。 资源全名:pytest_markers_presence-0.6.3-py2.py3-none-any.whl
资源来自pypi官网。 资源全名:pytest_markers_presence-0.4.0-py2.py3-none-any.whl
python库,解压后可用。 资源全名:pytest_markers_presence-0.4.0-py2.py3-none-any.whl
Multiple-markers-on-google-maps
视频+时间轴标记,videojs+markers 视频+时间轴标记,videojs+markers
at okhttp3.internal.io.RealConnection.connectSocket(RealConnection.java:144) at okhttp3.internal.io.RealConnection.connect(RealConnection.java:111) at okhttp3.internal....
unity在线地图Online Maps 2.5.16 需Unity 4.6.0或以上版本 Requires Unity 4.6.0 or higher. Features: ? Supports Unity v4.6+, Unity v5+; ? Standalone, Android, iOS, Windows Store, WebGL, Webplayer;...
JavaScript使用Marker方式展现出来,最终加到Markers图层上(非vector)
NULL 博文链接:https://jjxliu306.iteye.com/blog/2368918
前端项目-videojs-markers,video.js的video marker breaks插件