ChinaUnix.net
相关文章推荐:

initializer element is not constant

之前有人讨论了: http://bbs.chinaunix.net/thread-1275329-1-1.html 但是大家只是指出了原因, 并没有解决方案 原来的程序是英文的: typedef struct tag_tool_info{     char *description;     ....... } TOOL_INFO; static TOOL_INFO tool_info_list[]= {   { "file", ... },   { "edit", ... },   { "view", ... },   ... }; 这样编译没问...

by connet - C/C++ - 2008-11-26 14:52:03 阅读(2153) 回复(2)

相关讨论

论坛也有人讨论过这个错误,在http://bbs.chinaunix.net/thread-1285396-1-1.html中, 但没看懂。 我的test.c如下[code]#include typedef struct Admitem { const char *pcCommand; int (*pFunc)(int, char**); } Admitem_t; static int Start(int iArgc, char *cArgv[]) { return 0; } static int Stop(int iArgc, char *cArgv[]) { return 0; } static int Show(int iArgc, char *cArgv[]) { ...

by younglovej - C/C++ - 2010-08-26 12:11:59 阅读(5547) 回复(5)

试验用的gcc版本比较老。 以下两段代码,如果命名为 *.c 文件,在GCC下编译,都会报错,错误信息是“initializer element is not constant ”。 但是如果把 *.c 文件改名为 *.cc文件,用g++编译,就不会报错。 谁能详细解释一下这是为什么。 // code 1 int i = 10; int j = i + 4; // code 2 int i = 10; int main() { static int j = i; retrun 0; }

by kiffa - C/C++ - 2014-05-22 10:28:25 阅读(29835) 回复(7)

今天写了一个程序,编译时报了一个错误:expected initializer before "***" 报错的语句只是程序开头的一个变量定义语句,怎么会有这样的错误呢,琢磨了半天也没弄明白,最后发现是自己写的头文件最后一句少了 “;”。 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/78601/showart_1722297.html

by sparkzh - Linux文档专区 - 2008-12-15 23:13:43 阅读(1008) 回复(0)

因为程序中使用了如下的代码方式: struct A{ int a; int b; }; A a = {0}; // 编译这句话,就会产生这样的警告 在gcc 3.2.3上面就会出现这样的警告,在编译选项里面加了-Werror之后,就有问题,过不去了 在gcc 3.4.6 上面就不会出现这样的警告。 如果加了-Werror之后,能不能单独忽略某种类型的警告? 就像上面的那种警告。 谢谢!

by GodPig - C/C++ - 2009-10-14 11:40:01 阅读(1611) 回复(2)

typedef struct{ char szTagName[20]; //位号名 WORD wTagID; //位号ID WORD wTagType; //位号类型 WORD wRWFlag; //读写标记 WORD wUpNodeType; //挂接点 char szPhyNode[20]; //物理子项 char szModleName[20]; //所属模块名 WORD wHisFlag; char szTagDesc[40]; //位号描述 int wparam[8]; }cfg_SIGNAL; #define SIGN_SYS_NUM 10 const cfg_SIGNAL g_SignSys[SIGN_SYS...

by 白石 - Linux文档专区 - 2007-03-13 16:39:46 阅读(1088) 回复(0)

我使用DEV C++編寫 出現錯誤.. 我不了解問題點 #include #include #include using namespace std; int main(int argc, char *argv[]) { ifstream fins("total.txt"); if ( !fins ) { cout<< "\n員工總人數檔開檔失敗 ...\n"; system("pause"); exit(1); } // 開檔失敗 ifstream fint("title-code.txt"); if ( !fint ) { cout << "\n職稱代碼檔開檔失...

by dog_0729 - C/C++ - 2011-05-09 17:06:19 阅读(1741) 回复(3)

是什么意思呀。郁闷中.

by 78020281 - Java - 2004-10-11 20:35:40 阅读(1347) 回复(1)

/* written by LiYongQuan */ /* fetch data from a table, this table must contain two columns, one is department's ID, and another is department's name */ "); while($row=mysql_fetch_array($result)) {if($specify==$row["DID"]) $sel="selected"; else $sel=""; $DID=$row["DID"]; $DName=$row["DName"]; echo("$DName"); } if($all=="T") {if($specify=="%") $sel=...

by liyongquan - php文档中心 - 2006-05-31 23:57:27 阅读(1011) 回复(0)

我在LINUX下用GCC编译一个文件, 在文件中定义了这个变量 unsigned long const crc_32_tab[256]={ 0x00000000,0x77073096,0xee0e612c,0x990951ba,0x076dc419,0x706af48f,0xe963a535,0x9e6495a3 }; 为什么编译的时候有excess elements in scalar initializer 警告啊。 本来刚从NUCLUES转到LINUX下,觉得很多在ADS编译器下没错的,可是到了GCC编译器下就有问题。请教大家了

by sqq001 - C/C++ - 2014-09-23 18:40:19 阅读(14021) 回复(8)

xml: ... ; ; ... ; ; ; ... ; ; ; 我用Xerces dom 解析xml文件,请问上面的xml,当前element 为Activty 怎样取activity的孩子ExtendedAttribute,而不取other下的ExtendedAttribute

by webjlwang - Java - 2005-10-29 20:22:40 阅读(1742) 回复(4)