Compile c/c++ program using gcc -
i merging 2 complicated program, 1 written in c , other in c++.
here simplified situation.
my main programme written in c (main.c).
#include <stdio.h> #include "test.h" int main() { printf("test!\n"); } where test.h header of test.cpp, programme written others in cpp.
test.h
#include <vector> int test(); test.cpp
#include "test.h" int test() { homecoming 1; } i seek compile main.c using next command: gcc -c main.c -o main.o -lstdc++
but next error: fatal error: no such file or dirctory #include
i don't want alter codes of main.c or test.cpp since much more complicated in simplified example.
i new gcc, can help solve problem? many thanks.
you should compile g++, not gcc because it's c compiler , <vector> c++ header file (not mentioning <vecotr> typo)
if have utilize c compiler, have remove c++ dependencies header files included c sources.
c++ c gcc
No comments:
Post a Comment