g++ compiler not using precompiled header *.h.gch

this my log.cpp file.

#include <iostream>
using namespace std;

void log(){
    cout << "OMG, nothing is working...";
}

this my header file : log.h

void log();

this's my main.cpp file

#include "log.h"

int main(){
    log();
    return 0;
}

I want to precompile the header file I use this command g++ log.h I get log.h.gch file then I compile the main.cpp file using g++ main.cpp I get this Error :(

/tmp/cc9YGzwo.o: In function `main':
main.cpp:(.text+0x5): undefined reference to `log()'
collect2: error: ld returned 1 exit status[![help me please][1]][1]


from Recent Questions - Stack Overflow https://ift.tt/3i4rBfx
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)