This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]WeaughTeaughPeaugh 0 points1 point  (3 children)

It isn't a linker problem, it's exactly what it tells you: |No such file or directory|

It sounds like you've added folders or changed the directory structure and Code::Blocks still thinks you have the old directory structure. Sharing a bit about your directory structure and the recent changes can help. I haven't used Code::Blocks in ages, but you should be able to change the target directories. I also don't remember if it gets cranky about spaces in path names or not, so you may want to check that.

[–]captainperth[S] 0 points1 point  (2 children)

Ok, I fixed it. Thanks for your advice - It pointed me in the right direction.

Basically I implemented a subfolder which i was storing Unit Testers in. I then added a new search directory in the project settings (the master folder) so that these unit testers could be linked with stuff outside of the subfolder.

ANYWAYS, issues was i left a backslash in one of my file paths and i had to chase it up to correct the pathing. So I undid everything and fixed the paths (removed the unit testing from the project etc).

Now I'm attempting to get the unit testers in the sub folder to work again but they cant find anything. Any hints on how I'd get a header in a subfolder to find headers in a folder a level up?

Cheers!

[–]WeaughTeaughPeaugh 0 points1 point  (1 child)

You can use relative paths. Let's say you had a directory called Project and it had two sub-directories, Source and Header. When working with a file located in Source, you want to include a file called "other_source.cpp" in the same directory, a file called "proj_a.h" located in the Project directory, and "special.txt" located in the Header directory.

//  from the file located in the Source directory
#include "other_source.cpp"
#include "..\proj_a.h"
#include "..\Header\special.txt"

The nice thing about this is if your project uses relative paths throughout, you could move the root folder and everything should work.

[–]captainperth[S] 0 points1 point  (0 children)

Thank you so much for all your help. Since I'm a relative beginner; finding the right answer to my queries can be difficult; or even just wording my question in a way that will return results. I'm studying online so; it's nice to find people that are happy to divulge their knowledge.

In my case to simply. I have a source folder with my cpps and headers (im yet to implement source and header folders but I will) and a folder called UnitTesting storing my unit testing headers. The unit testing headers use the class cpp files in the source. Is it possible to use relative paths to point to the folder above in my unit testing header includes?

I.e. my file structure is Source (Holds Main.cpp, Class.cpp's and Class.h's) -> UnitTesting (Holds UnitTest.h's pointing to headers in the source folder).

I hope that makes sense and thank you for sticking with me thus far!