I have 3 files:
main.cpp:
#include "el.h"
int main(int argc, char* argv[])
{
printhw();
return 0;
}
el.h:
#ifndef __EL_H
#define __EL_H
#include <stdio.h>
void printhw(void);
#endif
and el.cpp:
#include "el.h"
void printhw(void)
{
printf("Hello my master\n");
}
If I build it by typing "gcc main.cpp el.cpp" in terminal - all ok. But if I build it in Code::Blocks I get error "main.cpp:(.text+0x2b): undefined reference to `printhw()'". Why?
Hello, file el.cpp should be include in the your project.
Project->Add Files.
Yes, I know it. Of course, I included this file in my project.