News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

[SOLVED]Problem with linking *.h files.

Started by wojciech, February 28, 2009, 11:55:32 PM

Previous topic - Next topic

wojciech

Hi,

I have one big problem with C::B. I just don`t know how to link header, i wrote something like this:
//main.cpp
#include "foo.h"
int main(){
bar A;
A.show();
}
//foo.h
class bar{
public:
int qwerty;
int show();
};
//foo.cpp
#include "foo.h"
int bar::show(){
return qwerty;
}

And when I try to compile,build and run this i got error "undefined reference to show()", what exactly means that something went wrong with linkink these files. I have no idea how to show linker what to link. (before i was using Kdevelop, and there was no issue with linker)

Sorry for that pool above, my mistake.

Jenna

If you have not yet created a project, do it now (wizard empty project).

Add both cpp-files and the header file, and that's  it.

wojciech

Ok, now i got it. I didn`t mark option in wizard "in build targets". Now i marked both options (debug, release) and it works :)