Hello, I'm trying to learn how to do basic modules in c++ but seems impossible to me in codebloks. The next code compile perfect using the bash order: g++ cab.cpp main.cpp -o executable_name
however when i try to compile over codeblocks, g++ says: reference to recogeValores() undefined
note: for build the project structure over codeblocks, first ia add the new project trough File--->New---> Project ---> c++ project, and after I add the interface .h and the implementation .cpp files through File--->New--->file--->c/c++ header
/* cab.h
Interface file */
void recogeValores();
Second, I build the implementation "cab.cpp"
/* cab.cpp
implement functions declared on interface */
#include "cab.h" //<--------------- Including the interface
#include <iostream>
using namespace std;
void recogeValores()
{
cout << "Se ejecutó recoger valores\n";
}
And for end, i make the main program
/* main.cpp */
#include "cab.h" //<--------------- Including the interface
#include <iostream>
using namespace std;
int main (){
recogeValores();
}
if somebody can explain me what i'm doing bad I will be greatful.
Thanks in advance