Author Topic: Codeblocks 12.11 Problem compiling or linking a module (SOLVED)  (Read 4574 times)

Offline yczo

  • Single posting newcomer
  • *
  • Posts: 8
Codeblocks 12.11 Problem compiling or linking a module (SOLVED)
« on: January 30, 2014, 05:59:53 pm »
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();


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";
}


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();
}

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

Thanks in advance
« Last Edit: January 30, 2014, 07:09:56 pm by yczo »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Codeblocks 12.11 Problem compiling or linking a module
« Reply #1 on: January 30, 2014, 06:49:26 pm »
we need the full build log...

Offline yczo

  • Single posting newcomer
  • *
  • Posts: 8
Re: Codeblocks 12.11 Problem compiling or linking a module
« Reply #2 on: January 30, 2014, 07:09:41 pm »
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.