Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22067

Strange message gcc while compilation of short c files

$
0
0

I just compiled a short c program with gcc and this is the answer it gave me :

t_out_buffer.c:19:8: error: conflicting types for ‘t_out_buffer_init’
 void   t_out_buffer_init(t_out_buffer *buf, int fd)
        ^~~~~~~~~~~~~~~~~
t_out_buffer.h:18:8: note: previous declaration of ‘t_out_buffer_init’ was here

        ^                

The line (18) it is refering is... empty.

In case it can be useful, here is the output of gcc -v:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1) 

Here is the content of the t_out_buffer.h file :

david@laptopone-ubuntu:~/42Projects/pf/t_out_buffer$ cat -ne t_out_buffer.h
     1  #ifndef T_OUT_BUFFER_H$
     2  # define T_OUT_BUFFER_H$
     3  # ifndef BUFFER_SIZE$
     4  #  define BUFFER_SIZE 128$
     5  # endif$
     6  # define T_OUT_BUFFERIZE_ERROR -1$
     7  # define T_OUT_BUFFERIZE_OK 1$
     8  $
     9  typedef int             t_count;$
    10  typedef int             t_idx;$
    11  typedef struct  s_out_buffer$
    12  {$
    13          char    buf[BUFFER_SIZE];$
    14          t_idx   idx;$
    15          t_count count;$
    16          int     fd;$
    17  }               t_out_buffer;$
    18  $
    19  void            t_out_buffer_init(t_out_buffer *buf, int fd);$
    20  t_count         t_out_buffer_size(t_out_buffer *buf, char const*start,$
    21                                    char const *end);$
    22  t_count         t_out_buffer_flush(t_out_buffer *buf);$
    23  #endif$

And here is (a part of) the content of the t_out_buffer.c file :

#include "t_out_buffer.h"
#include <unistd.h>

//...

void  t_out_buffer_init(t_out_buffer *buf, int fd)
{
   //...
}

//...
//...

Edit for Steve : here is tiny .c file that fails to compile with the same error :

david@laptopone-ubuntu:~/42Projects/pf/t_out_buffer$ cat -ne tiny.c
     1  #include "t_out_buffer.h"$
     2  #include <unistd.h>$
     3  $
     4  void    t_out_buffer_init(t_out_buffer *buf, int fd)$
     5  {$
     6          (void)buf;$
     7          (void)fd;$
     8  }$

Viewing all articles
Browse latest Browse all 22067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>