---
title: "C系列： 关于multiple markers at this line的error"
author: "justshare"
date: "2009-06-11T11:08:25Z"
tags: []
slug: "c-multiple-markers-at-this-line-error"
draft: false
lastmod: "2009-06-11T16:23:32Z"
id: 406522
url: "https://justshare.iteye.com/blog/406522"
---

事例：本来想在fileA.c中调用另外一个文件fileB.c中的函数printmessage，为了明确这种调用与被调用的关系，于是我就在fileA.c中通过#include把fileB.c文件包含进来，但是编译的时候fileB.c中报：
   
```java
Multiple markers at this line
      -syntax error before "..."
      -Syntax error
```

后来在fileA.c中把#include "fileB.c"语句去掉，编译通过

```java
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");
}
```


```java
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，很不适应呐！