User forums > Help

Codeblocks 12.11 Problem compiling or linking a module (SOLVED)

(1/1)

yczo:
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


--- Code: ---
/*  cab.h

    Interface file */

void recogeValores();


--- End code ---

Second, I build the implementation "cab.cpp"

--- Code: ---/*  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";
}


--- End code ---

And for end, i make the main program


--- Code: ---/*  main.cpp */

#include "cab.h" //<--------------- Including the interface
#include <iostream>


using namespace std;

int main (){
    recogeValores();
}

--- End code ---

if somebody can explain me what i'm doing bad I will be greatful.

Thanks in advance

BlueHazzard:
we need the full build log...

yczo:
Solved!

The problem was mine! Sorry, I forgot put a tick on Debug & Realase inside "add file to active project on build targets" for the implementation and declaration files                               

thank you for all.

Navigation

[0] Message Index

Go to full version