gcc学習記録

2413 ワード

次のエラーは、洪水の繰り返し定義から来ています.
sgy@ubuntu:~/sgy/watch/log_lib/EasyLogger/demo/os/linux$ make
cc -O0 -g3 -Werror -c exam.c -o exam.o -I./easylogger/inc  -I./easylogger/plugins/ -I../../../easylogger/plugins/ -I../../../easylogger/inc
mv exam.o out
cc -O0 -g3 -Werror -c main.c -o main.o -I./easylogger/inc  -I./easylogger/plugins/ -I../../../easylogger/plugins/ -I../../../easylogger/inc
main.c:37:0: error: "ELOG_OUTPUT_ENABLE" redefined [-Werror]
 #define ELOG_OUTPUT_ENABLE 1
 ^
In file included from ../../../easylogger/inc/elog.h:32:0,
                 from main.c:31:
./easylogger/inc/elog_cfg.h:33:0: note: this is the location of the previous definition
 #define ELOG_OUTPUT_ENABLE
 ^
cc1: all warnings being treated as errors
make: *** [main.o] Error 1
sgy@ubuntu:~/sgy/watch/log_lib/EasyLogger/demo/os/linux$ 

main.cのソースコード
/*
 * This file is part of the EasyLogger Library.
 *
 * Copyright (c) 2015-2017, Armink, 
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * 'Software'), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Function: linux demo.
 * Created on: 2015-07-30
 */

#define LOG_TAG    "main"

#include 
#include 
#include 
#include 

static void test_elog(void);
#define ELOG_OUTPUT_ENABLE 1

int main(void) {
   return EXIT_SUCCESS;
}