Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why won't my simple C++ console app see my simple C++ static library headers in Visual Studio 2015?

21 views
Skip to first unread message

Code Owl

unread,
Oct 22, 2015, 12:58:13 AM10/22/15
to
Hi there,

Basically I have created a simple C++ Static Library and linked it to a simple Console Application following the steps here:
https://msdn.microsoft.com/en-us/library/ms235627.aspx

All this worked as expected.

Then I added a second class (.cpp and .h) to the static library and I can not get that to link into the console app. The static library builds successfully but the console app throws the following error when I attempt to build it:

fatal error C1083: Cannot open include file: 'MyMathFuncs2.h': No such file or directory

Yet that file does exist, and it is in the same dir as the header that does work.

I have tried Clean, Rebuild of the console app and then re-adding in the new header and it still fails with the same error. Strangely if I delete the original class and header from the static library and then build the console app with a reference to the original class it builds successfully... even though the header doesn't exist.

What am I doing wrong here?

See full details of what I did here:
http://stackoverflow.com/questions/33258674/why-wont-my-simple-c-console-app-see-my-simple-c-static-library-headers-in

Thank you for your time,

Scott

Paavo Helde

unread,
Oct 22, 2015, 1:42:41 AM10/22/15
to
Code Owl <cod...@gmail.com> wrote in
news:860d9731-115c-4bf9...@googlegroups.com:

> Hi there,
>
> Basically I have created a simple C++ Static Library and linked it to
> a simple Console Application following the steps here:
> https://msdn.microsoft.com/en-us/library/ms235627.aspx
>
> All this worked as expected.
>
> Then I added a second class (.cpp and .h) to the static library and I
> can not get that to link into the console app. The static library
> builds successfully but the console app throws the following error
> when I attempt to build it:
>
> fatal error C1083: Cannot open include file: 'MyMathFuncs2.h': No such
> file or directory

Looks like you have messed something up. I even looked at the
stackoverflow page - yup, MyMathFuncs2 is a class name, not a header file
name. The header file name is MathFuncsLib2.h.

A tip: when you post problems here or elsewhere, include only the
relevant full set of *non-working* code. Currently on the stackoverflow
page you have listed a complete working solution (not needed) and a
partial non-working solution (most important bits missing), this is not
helpful.

Cheers
Paavo

Code Owl

unread,
Oct 22, 2015, 3:47:15 AM10/22/15
to
Paavo,

Great advise mate, I will take it on board. In fact I just redid the stack overflow question with screen shots of all the classes and an attachment of the VS solution... However in the process of doing such detailed documentation of the problem I found the cause of the issue!!

I had originally created the static lib project in the wrong location, so I removed it from the project and then copied it to another location (the same dir as the solution) and the added the existing project at the new location back into the solution. The problem was that the reference in the console application was still pointing to the original copy of the project no longer linked to the solution, and this is why my console app was not aware of changes I was making to the project linked to the solution.

Thanks again for your input mate ;-)

Regards,

Scott
0 new messages