c - 警告 :initialization from incompatible pointer type

标签 c gcc

我不明白错误在哪里。 为什么出现此错误消息: 从不兼容的指针类型初始化。 friend 们,请帮助我。

const struct _displayout_default
{
const char* length;
const char**  buf;

}DisplayOut_DEFAULT[2] =  
{
    {
    "02", 
    (const char*[]){
        "01",
        "02",
        "03",
        "04"
        }
    },
    {
    "02", 
    (const char*[]){
        "01",
        "02",
        "03",
        "04"
        }
    }
};    

更新:

MPLAB® C 编译器 对于 PIC32 MCU

C 标准信息 美国国家信息系统标准 – 编程语言 – C。 美国国家标准协会 (ANSI),11 West 42nd。纽约街头, 纽约,10036。

海湾合作委员会文件 http://gcc.gnu.org/onlinedocs/ http://sourceware.org/binutils/

编译器选项: -g -mlong-calls -DNDEBUG -Os

最佳答案

编辑(旧答案消失)

不幸的是,我无法使用相同的编译器和相同的选项重现消息:

T:\>"c:\Program Files (x86)\Microchip\mplabc32\v2.01\bin\pic32-gcc.exe" -g -mlong-calls -DNDEBUG -Os test.c

没有错误。

pic32mx-gcc-4.5.1.exe 一样 - 没有错误。


详细信息:

来源

const struct _displayout_default
{
    const char* length;
    const char**  buf;

}DisplayOut_DEFAULT[2] =  
{
    {
        "02", 
        (const char*[]){
            "01",
            "02",
            "03",
            "04"
        }
    },
    {
        "02", 
        (const char*[]){
            "01",
            "02",
            "03",
            "04"
        }
    }
};    

int main(int argc, const char *argv[])
{

    return 0;
}

编译器版本:

    pic32-gcc.exe: 2: No such file or directory
    Using built-in specs.
    COLLECT_GCC=c:\Program Files (x86)\Microchip\mplabc32\v2.01\bin\pic32-gcc.exe
    COLLECT_LTO_WRAPPER=c:/program files
    (x86)/microchip/mplabc32/v2.01/bin/../pic32mx/bin/gcc/pic32mx/4.5.1/lto-wrapper.exeTarget:
    pic32mxConfigured with: ../../src45x/gcc/configure --build=i386-pc-linux-gnu
    --host=i586-mingw32msvc --target=pic32mx --disable-threads --disable-libmudflap
    --disable-libssp --disable-libstdcxx-pch --disable-hosted-libstdcxx
    --with-arch=pic32mx --enable-sgxx-sde-multilibs --disable-threads --with-gnu-as
    --with-gnu-ld --disable-sim --disable-bootstrap --enable-obsolete
    --disable-__cxa_atexit --disable-libfortran --enable-languages=c
    --disable-shared --with-newlib --disable-nls
    --prefix=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/pic32-tools
    --disable-libgomp --without-headers --disable-libffi --enable-gofast
    --enable-poison-system-directories --program-prefix=pic32-
    --libexecdir=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/pic32-tools/pic32mx/bin
    --with-dwarf2 --with-host-libstdcxx='-static-libgcc
    -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
    --with-libelf=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/canadian-cross-build/mingw32-libs
    --enable-lto
    --with-gmp=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/canadian-cross-build/mingw32-libs
    --with-ppl=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/canadian-cross-build/mingw32-libs
    --with-cloog=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/canadian-cross-build/mingw32-libs
    --with-zlib=/home/c11067/work/C32/builds/pic32-microchip-release-2.01-freeze-20110726/canadian-cross-build/mingw32-libs
    --with-bugurl=http://www.microchip.com/supportThread model: singlegcc version
    4.5.1 MPLAB C Compiler for PIC32 MCUs v2.01-20110816 (Microchip Technology)

关于c - 警告 :initialization from incompatible pointer type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8319378/

相关文章:

与 GCC 输出混淆

c - 不知从何而来的 Bison 语法错误

c - C 代码中的语法错误

c - free 导致 malloc 产生不同的结果

c++ - 链接C++程序时出错

c++ - 为什么 sizeof(std::stack<int>) 这么大?

c - __attribute__((packed)) 对嵌套结构数组的影响?

c - 在 C 中通过引用传递删除列表中的节点

C : Deleting only one node from a doubly linked list

c++ - 指针行为给出的值为 1