Fatal error: iostream: No such file or directory in compiling C program using GCC

后端 未结 2 1438
清酒与你
清酒与你 2020-12-30 08:33

Why when I wan to compile the following multi thread merge sorting C program, I receive this error:

ap@sharifvm:~/forTHE04a$ gcc -g -Wall -o mer mer.c -lpth         


        
2条回答
  •  甜味超标
    2020-12-30 09:30

    Neither nor are standard C header files. Your code is meant to be C++, where is a valid header. Use g++ (and a .cpp file extension) for C++ code.

    Alternatively, this program uses mostly constructs that are available in C anyway. It's easy enough to convert the entire program to compile using a C compiler. Simply remove #include and using namespace std;, and replace cout << endl; with putchar('\n');... I advise compiling using C99 (eg. gcc -std=c99)

提交回复
热议问题