Tag: gcc

如何告诉GCC循环自动矢量化没有指针别名? (限制不起作用)

我在让GCC对这个循环进行矢量化时遇到了问题: register int_fast8_t __attribute__ ((aligned)) * restrict fillRow = __builtin_assume_aligned(rowMaps + query[i]*rowLen,8); register int __attribute__ ((aligned (16))) *restrict curRow = __builtin_assume_aligned(scoreMatrix + i*rowLen,16), __attribute__ ((aligned (16))) *restrict prevRow = __builtin_assume_aligned(curRow – rowLen,16); register unsigned __attribute__ ((aligned (16))) *restrict shiftCur = __builtin_assume_aligned(shiftMatrix + i*rowLen,16), __attribute__ ((aligned (16))) *restrict shiftPrev = __builtin_assume_aligned(shiftCur – rowLen,16); unsigned j; unsigned […]

使用gcc编译C时,预处理的.i文件中的数字含义是什么?

我想了解编译过程。 我们可以使用以下命令查看预处理器中间文件: gcc -E hello.c -o hello.i 要么 cpp hello.c > hello.i 我大致知道预处理器的作用,但我很难理解某些行中的数字。 例如: # 1 “/usr/include/stdc-predef.h” 1 3 4 # 1 “” 2 # 1 “hello.c” # 1 “/usr/include/stdio.h” 1 3 4 # 27 “/usr/include/stdio.h” 3 4 # 1 “/usr/include/features.h” 1 3 4 # 374 “/usr/include/features.h” 3 4 这些数字可以帮助调试器显示行号。 所以我对第一列的猜测是第2列文件的行号。 但是以下数字有什么作用?

GCC编译器优化,无法与架构x86_64的主可执行文件“_”链接

*Antonio10ms$ gcc pi.c -o1 pi ld: can’t link with a main executable file ‘pi’ for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 我需要帮助才能对我的.cpp进行优化

无法配置交流编译器

我正在尝试使用gcc 4.7编译一些库(我刚从4.6.3升级,不知何故它抱怨c编译器: /home/rtbkit/platform-deps/node/wscript:263: error: could not configure ac compiler! make[1]: Entering directory `/home/rtbkit/platform-deps/node’ Project not configured (run ‘waf configure’ first) make[1]: *** [program] Error 1 make[1]: Target `all’ not remade because of errors. make[1]: Leaving directory `/home/rtbkit/platform-deps/node’ make[1]: Entering directory `/home/rtbkit/platform-deps/node’ Project not configured (run ‘waf configure’ first) make[1]: *** [program] Error 1 make[1]: Target […]

C:关于结构可见性的警告

我有一个复杂的C项目。 在文件message.h我声明了这个结构 struct message { int err; struct header { char *protocol_version; char *type; long int sequence_number; } header; struct body { int num_tag; char *tag_labels[LEN]; int num_attr_tag[LEN]; char *attr_labels[LEN][LEN]; char *attr_values[LEN][LEN]; char *attr_types[LEN][LEN]; } body; }; 在文件“castfunctions.h”中,我包含文件“message.h”,我声明函数“setClientNat” #include void *setClientNat(struct message *msg); 当我编译时,我有这个警告 castfunctions.h:warning: declaration of ‘struct message’ will not be visible outside of […]

以下给出的代码是错误的吗?

#include int main() { int a; printf(scanf(“%d”,&a)); return 0; } 我收到此消息“Segmentation fault(core dumped)”

使用gcc通过javacode编译C源代码

我试图使用exec方法通过java代码编译c文件 String inputFilePath = “\”D:\\Soft\\WebApplication\\build\\web\\code\\Demo.c\””; String[] commands = {“cmd”, “/c”, “gcc”,inputFilePath,”-o”,”Demo”}; Process p=Runtime.getRuntime().exec(commands); DataInputStream din=new DataInputStream(p.getErrorStream()); String s=””,temp; while((temp=din.readLine())!=null) s+=temp; if(s.equals(“”)){ cf.setResult(“No Syntax Error”); } else cf.setResult(s); 但它不会生成demo.exe文件

根据第三方库链接到库

我正在创建一个依赖于其他库( libpng , libX11等)的库。 我想知道是否有可能(例如某些标志)用户二进制文件不能直接链接到第三方库,而是通过我的lib间接链接。 这是一个例子: libb.c (作为第三方库) int get21() { return 21; } liba.c (作为我的lib) int get21(); int get42() { return get21() * 2; } main.c (作为用户代码) int get21(); int get42(); int main() { printf(“42 = %d\n21 = %d\n”, get42(), get21()); return 0; } 汇编 $ gcc -fPIC -shared libb.c -o libb.so $ gcc […]

在GCC中编译C文件时出错(多个文件合二为一)

该程序certificate了一串文本。 这是我的代码(main是justify.c): justify.c #include #include “line.h” #include “word.h” #define MAX_WORD_LEN 20 int main(void) { char word[MAX_WORD_LEN+2]; int word_len; clear_line(); for(;;) { read_word(word, MAX_WORD_LEN+1); word_len = strlen(word); if(word_len ==0) { flush_line(); return 0; } if (word_len >MAX_WORD_LEN) word[MAX_WORD_LEN]=’*’; if(word_len + 1 > space_remainding()) { write_line(); clear_line(); } add_word(word); } } line.c #include #include #include “line.h” #define […]

如何编译这个C程序?

当我输入gcc gprof-helper.c来编译程序时,我得到以下错误: gprof-helper.c: In function `wooinit’: gprof-helper.c:38: error: `RTLD_NEXT’ undeclared (first use in this function) gprof-helper.c:38: error: (Each undeclared identifier is reported only once gprof-helper.c:38: error: for each function it appears in.) 这是程序文件: #define _GNU_SOURCE #include #include #include #include #include static void * wrapper_routine(void *); /* Original pthread function */ static int (*pthread_create_orig)(pthread_t *__restrict, __const […]