Sign in to follow this  
Domarius

VCC - share classes between projects within same solution?

Recommended Posts

I have one solution, which contains 2 projects - an application that the users will use, and a command line tool that technically inclined people will use to set up the app. Both of these projects share functionality, so I thought it would be fairly sensible for them to require the same cpp & h files. I can't find a way of doing this without getting linker errors. Is there a specific way? I added the files from one project into the other project (so its just pointing to the same files) but then I get \RomPaths.cpp(63): fatal error C1010: unexpected end of file while looking for precompiled header directive when compiling the app that had the files added to the project (and doesn't acutually have the original files in its folders)

Share this post


Link to post
Share on other sites
Okay out of desperation I manually copied the relevent files over to the other project that needs to share them - and I still get the same error. I don't even know what it means...

Share this post


Link to post
Share on other sites
Some info on the net tells me that all I have to do is add the required files to the project, without duplicating the files themselves, and it should work, so I guess my problem is a different one.

http://www.delphifaq.com/faq/f923.shtml
Seems my problem might be with this. I do have a stdafx.h file but I've never had to use it before. I just created a new console app and accepted the default code. Normally I've been taught (in class) to make an empty project, and we don't use stdafx.h

I guess I'll keep experimenting.

Share this post


Link to post
Share on other sites
Try turning off precompiled headers (Project Properties -> C/C++ -> Precompiled Headers) or including "stdafx.h" at the start of each source file in any projects in which you are using precompiled headers.

Share this post


Link to post
Share on other sites
Thankyou! That was all it was, it's working great now. I think I even have that little tidbit in my notes somewhere...

You brought my project out of a stand-still :) I wasn't going to progress until I'd solved this.

Share this post


Link to post
Share on other sites
A cleaner solution would be to put the shared functionality in a library project that both the command-line and windows-based projects import.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this