?
Solved

reference to another project

Posted on 2004-11-24
6
Medium Priority
?
220 Views
Last Modified: 2010-04-24
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
0
Comment
Question by:__Julien__
  • 3
  • 2
5 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 12663199
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
 

Author Comment

by:__Julien__
ID: 12663537
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
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 12664001
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
 
LVL 48

Expert Comment

by:AlexFM
ID: 12856320
I am still waiting for __Julien__'s response. Without his feedback I think that my answer is OK.
0
 

Author Comment

by:__Julien__
ID: 12875389
Sorry for the delay, I thought I had already accepted the answer.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question