Code::Blocks Forums

User forums => Help => Topic started by: yczo on January 30, 2014, 05:59:53 pm

Title: Codeblocks 12.11 Problem compiling or linking a module (SOLVED)
Post by: yczo 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
Title: Re: Codeblocks 12.11 Problem compiling or linking a module
Post by: BlueHazzard on January 30, 2014, 06:49:26 pm
we need the full build log...
Title: Re: Codeblocks 12.11 Problem compiling or linking a module
Post by: yczo 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.