Compiling C and C++ files together using GCC

后端 未结 6 906
[愿得一人]
[愿得一人] 2020-12-07 16:38

I\'m trying to compile C and C++ sources together using GCC.

gcc -std=c++0x test.cpp -std=c99 test.c -lstdc++

Now, this works fine, except that

6条回答
  •  醉梦人生
    2020-12-07 17:35

    I ran into this problem too. I didn't find a way to compile c and c++ with a one liner but using autotools autoconf it will generate the proper configuration and Makefile for each .c and .cpp or .cc to compile them individually and then link them. https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html

提交回复
热议问题