User forums > Help
Problems with Projects
muppetjones:
I'm using Code::Blocks on Linux, specifically Ubuntu 9.10.
Problem: My projects cannot find and use the files from other projects.
I have 2 projects: bStats and bStream. Both work and compile just fine within their own projects, and both have their files in the same place with the same structure (~ used simply for brevity):
~/lib/bSt*/bS*.h
~/lib/bSt*/bS*.cpp
Where the project files are located in:
~/projects/bSt*/
Using these include lines:
--- Code: ---#include "bStat/bStat.h"
#include "bStream/bStream.h"
--- End code ---
In each package the file is found, and works fine for the respective package. The problem I'm running into is when I actually try to use the package:
--- Code: ---bStream bs;
--- End code ---
I get the following error
--- Code: ---/home/muppetjones/Ubuntu One/projects/bStat/main.cpp||In function ‘int main()’:|
/home/muppetjones/Ubuntu One/projects/bStat/main.cpp|21|error: ‘bStream’ was not declared in this scope|
/home/muppetjones/Ubuntu One/projects/bStat/main.cpp|21|error: expected ‘;’ before ‘bs’|
||=== Build finished: 2 errors, 0 warnings ===|
--- End code ---
I know this is not a C++ error -- it is project dependent, which tells me there is a problem calling code from different projects.
I have tried adding the class directory, the lib directory...everything I can think of and in all the places which seem appropriate, but nothing seems to work. Please help!
killerbot:
I think the lib library should be added as the include dir in both projects.
muppetjones:
I tried a variety of path names. The only two which find the file are:
--- Code: ---#include "/home/muppetjones/Ubuntu One/lib/bStat/bStat.h"
#include "/home/muppetjones/Ubuntu One/lib/bStream/bStream.h"
--- End code ---
and
--- Code: ---#include "bStat/bStat.h"
#include "bStream/bStream.h"
--- End code ---
If you mean add the 'lib/' directory to the "search directories", I have done so both for the project and globally. Again, it works for the calling project just fine, i.e. calling "bStat/bStat.h" works fine in the bStat project, but refuses to work in the bStream and vice versa.
muppetjones:
Update: I tried, just for the fun of it, using a single project and adding all of the files -- same issue, with a couple of clarifications: the order of includes counts.
--- Code: ---#include "/home/muppetjones/Ubuntu One/lib/bStream/bStream.h"
#include "/home/muppetjones/Ubuntu One/lib/bStat/bStat.h"
--- End code ---
causes
--- Code: --- bStat m(v);
bStream bs;
--- End code ---
to scream about bStat. Reverse the include, and it throws a fit about bStream.
Apparently I can only include one custom file?
Zini:
The error message indicates, that there is no problem with the include paths (the compiler would complain about the #include instruction otherwise). This looks like a bug in your code. Let me guess? Cyclic includes (i.e. two headers including each other)? Anyway, I think this is off-topic here.
Navigation
[0] Message Index
[#] Next page
Go to full version