User forums > Help

Include file not found

<< < (3/4) > >>

Jenna:
Which version of C::B do you use ?
The class-wizard has an option to add the paths to the project, but I do not rememeber if it was added before or after the last release (13.12).

bangorme:
I'm learning all kinds of stuff here, like C::B is the abbreviation for CodeBlocks.   I was using 12.11.  I found the nightly builds repository and am now running the lastest build.  I'll test it today and see if the problem is fixed.

Jenny178:

--- Quote from: bangorme on July 14, 2014, 06:01:57 am ---
--- Quote from: oBFusCATed on July 14, 2014, 02:42:52 am ---Nope. I'm asking how have you added the file in <project_root>/include?

--- End quote ---

Ok, when I want to make a header file for a project, I do file->new->class and codeblocks automatically creates /headers/include in the project and creates the header template file in the include folder.  This folder is within the project.  Compiling at that point gives the error that the header can't be found.  Using the method I stated above, causes the compiler to search that folder for header files.  

But, now that I'm thinking about it, my method works, but is not correct. Although it does work, you don't want to use it. I think it makes this project header folder the global header folder for all projects.  The proper way (which makes the project header folder searchable  by only this project) would be the way I think you spoke of earlier.  Project->Build Options->Search Directories tab.  On the left you will see the project name, debug and release.  Click the project name.  Then just press the "new" button.  In the box that comes up is a button the allows you to see the project directory and just click the "include" directory under your project.  



--- End quote ---

Hi
I am trying to go to project > build options but I don't have such menu.

pirx67:
Are you sure you have created a project? How it is done is explained http://wiki.codeblocks.org/index.php?title=Creating_a_new_project.

If you have a project and it is opened / active in the menu "Project" should be a selectable sub-menu "Build options ...".
You can even right click the project name in the project manager tab and select "Build options ..." from the
popup menu. At least in current C::B releases.

Please supply the C::B version and operating system and its version to narrow the possible range of guessing.

Thanks,
    pirx67

bangorme:
Well, I'm just getting back into C++ and having the exact same problems, even using the fix I posted earlier:

This is cut and pasted from  the book "Professional C++"

// SpreadsheetCell.h
class SpreadsheetCell
{
 public:
  void setValue(double inValue);
  double getValue() const;

 protected:
  double mValue;
};

// SpreadsheetCell.cpp
#include "SpreadsheetCell.h"

void SpreadsheetCell::setValue(double inValue)
{
  mValue = inValue;
}

double SpreadsheetCell::getValue() const
{
  return mValue;
}

#include "SpreadsheetCell.h"
#include <iostream>
using namespace std;

int main()
{
  SpreadsheetCell cell1;
  cell1.setValue(5.3);
  cout << cell1.getValue() << endl;

  return 0;
}

When I compile, I get the following errors:

||=== Build: Debug in SpreadsheetCellNumOnly (compiler: GNU GCC Compiler) ===|
/home/xxxx/Documents/Code Blocks Prj/SpreadsheetCellNumOnly/src/SpreadsheetCell.cpp|4|error: no ‘void SpreadsheetCell::setValue(double)’ member function declared in class ‘SpreadsheetCell’|
/home/xxxx/Documents/Code Blocks Prj/SpreadsheetCellNumOnly/src/SpreadsheetCell.cpp|9|error: no ‘double SpreadsheetCell::getValue() const’ member function declared in class ‘SpreadsheetCell’|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


Once again, it appears that Codeblocks isn't including Spreadsheet.h while compiling, even though I manually went in (as I posted previously) included the "include" directory in the project search path.  In fact, when I type in the code, Codeblocks correctly pops up the  Spreadsheet class methods correctly???????  Anyone have with an idea as to what's going on?

Thanks.


Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version