Hello
I'm fairly new to C programming, but I have some experience with Python. I'm facing a problem that's quite difficult for me to solve. I have actually read these boards all day, and tried to Google this issue that many seemed to had, but I still couldn't figure it out.
The problem is that I can't get additional function to work that is in separate file using the header include code.
I have read that you must add the path link to complier, linker and resource complier from search directories tab, from the project Built options, which I have done, but the error remains the same. That is, "undefined reference to "doubleUp"".
I have also tried to change the #include tag from "#include "test.h"" to "#include "C:\thePathToDir\test.h"" with no effect either.
The only thing that actually makes it work is to change the file extension to .c (as #include "test.h" -> #include "test.c") but I realize that is not the correct way to do it.
Here's a shorter code of my actual problem:
main.c
---------
#include <stdio.h>
#include <stdlib.h>
#include "test.h"
int main()
{
int number = 4;
int multiply = doubleUp(number);
printf ("%d times 2 equals %d.\n", number, multiply);
return 0;
}
test.c
-------
#include "test.h"
int doubleUp(int number)
{
return number*2;
}
test.h
-------
int doubleUp(int number);
Here's a screenshot of the Code blocks project view. Is there anything wrong there? Shouldn't the .h and .c files (test.h and test.c) be under the project three?
[IMG=http://img862.imageshack.us/img862/1034/guia.png][/IMG]Any help would be deeply appreciated.