EDIT: The solution to the problem is this: http://www.jusuchyne.com/codingchyne/2011/03/codeblocks-failed-to-find-the-header-file/
It will not compile, I have the following errors:
- foo.h there is no such file in the directory;
- foo has not been declared;
- num has not been announced in this area
- foo is not a class or namespace
This is at least strange because I just used the "Create a new class" code blocks and then added it to this project. This is the source code:
Title:
#ifndef FOO_H #define FOO_H class foo { private: int num; public: foo(); void set_num(int set); int get_num(); }; #endif
cpp
#include "foo.h" foo::foo() { num = 10; } void foo :: set_num(int set) { num = set; } int foo :: get_num() { return num; }
Ignore the calz itself and what it does, the problem is that it does not compile, although I used the default code class creation setting.
Errors:
C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|1|error: foo.h: No such file or directory| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|3|error: 'foo' has not been declared| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|3|error: ISO C++ forbids declaration of 'foo' with no type| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp||In function 'int foo()':| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|5|error: 'num' was not declared in this scope| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|6|warning: no return statement in function returning non-void| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|8|error: 'foo' is not a class or namespace| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp||In function 'void set_num(int)':| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|10|error: 'num' was not declared in this scope| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|13|error: 'foo' is not a class or namespace| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp||In function 'int get_num()':| C:\Users\SameTime\Desktop\CodeBLocks\ASDD\src\foo.cpp|15|error: 'num' was not declared in this scope| ||=== Build finished: 8 errors, 1 warnings ===|
source share