2019-04-06

$gcc -o hello hello.c  //-o选项用来指定输出文件的文件名。

gcc *.c -o hello  //使用通配符编译当前目录下的所有c文件

$ gcc -v -x c -E /dev/null  //查看gcc的默认include目录

使用ldd 查看依赖的动态库so  https://www.cnblogs.com/LiuYanYGZ/p/5545835.html

2019-04-07

Android.mk设置编译的是32还是64.https://ask.csdn.net/questions/232666

生成so包:$ gcc test_a.c test_b.c test_c.c -fPIC -shared -o libtest.so

2019-11-13

可能是Android Studio不够完善,写了一个函数,一直报错闪退,编译器没报错,后来发现,我定义是int test4(),

但是没有返回值,加一个return 0;就好了。这个不应该是编译器提示一下的吗,我确实有几年没写c了。

2020-09-13

ghttp已经安装了:

[root@izwz9eo2whsnfgi4ccyqouz test]# gcc main2.c
/tmp/ccRCX9fU.o: In function `main':
main2.c:(.text+0x20): undefined reference to `ghttp_request_new'
main2.c:(.text+0x35): undefined reference to `ghttp_set_uri'
main2.c:(.text+0x43): undefined reference to `http_hdr_Connection'
main2.c:(.text+0x4b): undefined reference to `ghttp_set_header'
main2.c:(.text+0x57): undefined reference to `ghttp_prepare'
main2.c:(.text+0x63): undefined reference to `ghttp_process'
main2.c:(.text+0x6f): undefined reference to `ghttp_get_body'
main2.c:(.text+0x7f): undefined reference to `ghttp_get_body_len'
main2.c:(.text+0xa3): undefined reference to `ghttp_request_destroy'
collect2: error: ld returned 1 exit status

后来改成:gcc main2.c -lghttp  就好了。

2021-08-07

c本身是跨平台,但需要在不同平台编译(前提是语法没有夹带私货【非跨平台语法和变量】)

 

相关文章:

  • 2021-10-05
  • 2021-10-19
  • 2022-12-23
  • 2021-06-21
  • 2022-01-19
  • 2021-10-23
猜你喜欢
  • 2021-06-24
  • 2022-01-10
  • 2022-12-23
  • 2021-12-06
  • 2022-02-01
  • 2021-10-27
  • 2022-12-23
相关资源
相似解决方案