reference to another project

I'm new on Visual and I've got a project under Visual.NET 2002 in unmanaged C++. The project code contained the code for all the tests. It was a problem because even under Release configuration, the tests were compiled and a dll was requested at run-time. As I didn't want the client to install this dll, I created another project in the same solution where I moved the tests.
I tried to compile this new project but it didn't work.
I copied the stdafx from the main project to the new one. There is an improvement but it still doesn't compile. For example, at the line
      enum { IDD = IDD_AVAILABLE_CODES_DLG };
it doesn't know IDD_AVAILABLE_CODES_DLG. I've tried to copy the .rc and .rc2 files as well as the resource.h but to no avail.

Can someone help me?
Thank you
__Julien__Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
IDD_AVAILABLE_CODES_DLG is defined in resource.h. Ensure that resource.h file is included before dialog h-file. Usullay every cpp file in MFC project has the following include lines:

#include "stdafx.h"
#include "MainApp.h"    // Application class h-file, which includes resources.h
#include "ThisClass.h"   // this class h-file
// other include lines

Instead of MainApp.h you can use resources.h:

#include "staafx.h"
#include "resource.h"
#include "ThisClass.h"   // this class h-file
// other include lines

In any case, when ThisClass.h is compiled, resource.h is already included.
0
__Julien__Author Commented:
OK, it works but now I've got plenty of "unresolved external references" for all my first project's methods called from my test project. I understand what it means but how can I fix this under Visual ?
0
AlexFMCommented:
It's impossible to call methods of one executable file from another. I am trying to undestrand your first post - do you have exe project with some testing code which should be excluded from final Release file? In this case you can use conditional compilation. For example, all test code fragments may be between precompiler directives:

#ifdef TEST_CODE
...
#endif

TEST_CODE may be defined in the project settings. You may create various configurations for testing and final release. Or you can add testing code only to debug cobfiguration.

Another way is moving all tesing code to delay-loaded Dll. If Dll is available at run-time, testing code may be executed. If not (for client release), testing code is not executed. Program can test whether Dll is available using LoadLibrary.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
I am still waiting for __Julien__'s response. Without his feedback I think that my answer is OK.
0
__Julien__Author Commented:
Sorry for the delay, I thought I had already accepted the answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.