Good I use AIDE. I am trying to make a prototype of the method in the header file, and the execution is in .cpp, but something does not rob (I blame the compiler for the whole curve, although it is possible that I am a curve: D) Here is the code:

hello.cpp:

#include <iostream> #include "Hider.h" using namespace std; int main() { TestClass cl; cout « cl.getAuthor() « endl; } 

Hider.h:

 #pragma once class TestClass{ public: std::string getAuthor(); }; 

Hider.cpp:

 #include "Hider.h" std::string TestClass::getAuthor(){ return "Hello from C++ File :D"; } 
  • And what about including in the project (or how it is there in AIDE called) of both cpp-files? Are they both included? Well, also - <string> not included in hider.cpp , so this file is unlikely to be compiled - how can he know what it is - std::string ... - Harry
  • The fact of the matter is that, as far as I know, in AIDE, you cannot manually include files, the compiler does everything. - Dmitry
  • The compiler must itself understand what to compile and what not? I didn’t work with AIDE, but I don’t believe in such miracles ... - Harry
  • From the compilation controls - only the RUN button - Dmitry
  • Error: undefined reference to "TestClass :: getAuthor ()" - Dmitry

1 answer 1

I don’t know what exactly he swears at the Undefined Reference, but I guess it’s on the string in Hider.h. If, however, he swears there, then it is necessary, for example, to insert #include <string> in the second line