Tag Archives: adding header

Errors, simple not complex – Part One

Programming, it’s a complex beast. While I haven’t talked much about my current studies in C++ you can safely assume I’m knew to the language and it’s intricacies.

The current assessment i’m working on requires an SQL database. All well and good I think to myself. I’ve done plenty of PHP and MySQL web dev.This will be a breeze.

That's pretty breezy

That’s pretty breezy image from: https://www.pinterest.com/vivamune/windy-dogs/

I knew I needed to use SQLite as defined by the assessment. So I need a library or something? Heading over to SQLite.org has everything you need to get going.

So, I added the .h and .c files through the right click “Add existing item” menu. Then i’m presented with the below error.

Cannot open source file

Cannot open include file

Looks can be scary

Looks can be scary

What is going on? I start looking deeper, maybe there is more involved to getting this going than I first thought.

I spent hours over two days looking for a solution, I tried building libraries including everything and altering so many settings of the project. Pro tip: do not alter settings because you feel like a good tweaking can fix everything, it doesn’t.

The solution

Copy the .h and .c files into my visual studio project.

I twigged that I might be barking up the wrong tree when I read the following.

stack overflow solution

I love you stack overflow

The solution explorer doesn’t show if stuff is usable! how helpful, knowing that I brought the files into the project and re-added them. Including the header no longer broke stuff. Progress!

Take it from me

So many times I have been caught out by this. The error is not cryptic at all, Visual Studio has no idea that i’m not going to link to the assets through one of the many methods it has for this.

So it told me it has no idea where to actually open the files, only that it knows I want them open. I feel you Visual studio and i’m sorry I didn’t understand.

Let’s not assume

I’m used to using 3D applications, for the most part these applications allow you to drag and drop assets into a content/project manager where they will either:

  • Import the asset into the project

Easy for asset management, common in game engines

  • Create a link/reference to the assets location and load it from there

Forces you to manage your assets wisely or rue the day you laughed as you linked assets from several different hard drives.

I assumed that by showing the files in the project solution VS could use them, this turns out to not be the case.

No I do not want to add includes to the project to work around this or setup a central place to include from. That’s for future me.

As with all lessons it’s well learned, learning them faster would be nice though.