Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Using classes

Author
Message
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 17th Mar 2008 19:39
This may not be quite the appropriate place to ask but since I can't find the proper usenet ng I'll rely on the expertise of those here who may being doing this.

Basically I built some classes for the GDK on the fly with one project. Since I was going to be moving into other related projects I decided to put the files for the classes in a single folder and with the new project I just "added an existing object" and pointed to the files in the "common" directory. I modified some of the files but when I went to compile VS acted as if it expected to find these files in the same directory as the project/solution. At that point I copied them over but felt this wasn't the solution for files that you want to keep synchronized in all projects.

Is it needed or appropriate to use the same method that defines what folders to use for includes to define where to find shared source files also? Or is there some other mechanism I should be using?

Thanks,

Lilith, Night Butterfly
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 17th Mar 2008 22:48
Its under Tools/Options/Projects/VC++ Directories. That's where you can add include file paths, lib file paths, etc. Just add the path where they reside, and use #include <headerfilename>

Or, you could include them with the fully qualified pathname using a literal string (#include "C:/temp/include/foobar.h"), but doing it the above way helps you with reuse, for example. I have a separate include and source directory where I stick common code, and the VC++ search path includes them using the first method.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 17th Mar 2008 22:59
Thanks. Then I'm to understand that the search directory also works for the source directory as much as the include directory?

I suppose I could also take the tactic of making the classes a separate project and creating a solution dependency that would force the "class project" to be recompiled if I've got any changes.

Lilith, Night Butterfly
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 17th Mar 2008 23:37
Well, no...it doesn't need to be that way. Just the include file path. You can add the source using the normal method...in the Solution Explorer panel, under the tab Solution, item Source Files. Right click that, and choose "Add existing item", then you browse to the source file for the class, and add it.

Then, you include the include file in your source file that wants to use the class.

Not every include file relates to a source file in the project. In fact, most don't...they relate to either library code that will be added to the executable, or to DLLs that will be linked with at run time.

I hope that explains, rather than confuses.
Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 19th Mar 2008 13:15
i use the actual Dark GDK libs and header folder. as the wizard automatically links those folders.

Stuck in the land of the confused! and loving it!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Mar 2008 19:59
I have the same issue... and hate fussing with all the settings.

For my deal - I made a solution, and I have multiple projects. Each Project I borrow from the others - by adding them (not moving them) just adding them ... and the includes use the greater than and less than signs versus the quotes. The quote are for the files of the project I'm "in". Seems to work.

I have to check out jenzai's solution though.

But I can be in any project within my solution and edit a file and its reflected everywhere because its the same file... not literal copies.

Login to post a reply

Server time is: 2024-11-20 05:24:19
Your offset time is: 2024-11-20 05:24:19