Making a Sample Win32 DLL project Using Visual Studio 2010 Professional

I made a Win32 DLL project  I called 'Win32DLLExample'. It compiles fine, and the DLL was created in its the Debug folder.
The simple Win32 DLL I madeI also made a win32 executable project in Visual Studio 2010 to run and access the functions in the DLL:
Win32 Executable Project to access DLL functionsI find it strange, but it looks like I can only have one project open at a time. When I open the new project the
other one closes.

Is that correct, in Visual Studio 2010?

Then, when I try to compile, it doesn't work of course:

------ Build started: Project: MyWin32CppApp, Configuration: Debug Win32 ------
Build started 1/30/2016 10:23:47 AM.
InitializeBuildStatus:
  Touching "Debug\MyWin32CppApp.unsuccessfulbuild".
ClCompile:
  Main.cpp
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(6): error C2871: 'Win32CppDLLExample' : a namespace with this name does not exist
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2065: 'MyWin32ClassOne' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2146: syntax error : missing ';' before identifier 'sc1'
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(13): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(13): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(14): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(14): error C2228: left of '.Setvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(15): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(15): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2065: 'MyWin32ClassTwo' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2146: syntax error : missing ';' before identifier 'sc2'
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(18): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(18): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(19): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(19): error C2228: left of '.Setvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(20): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(20): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''

Build FAILED.

Time Elapsed 00:00:01.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Open in new window


I already have additional include directories set up to cover the DLL header files:
Additional Included DirectoriesBUT!
I cannot add reference to DLL project - no projects are selectable:
Cannot set reference to DLL project
So, what can I do so that it compiles?

Also, once done, how can I run the compiles program and the compiled DLL together, outside the IDE?

Thanks.
AttilaBAsked:
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.

David Johnson, CD, MVPRetiredCommented:
you are mixing up solutions and projects
a solution can consist of several projects and only 1 solution can be active at a time.
AndyAinscowFreelance programmer / ConsultantCommented:
>>I find it strange, but it looks like I can only have one project open at a time
You have two different solutions each with one project.  You can only have one solution open at once BUT a solution can contain many projects.

So import the dll project into the executable solution.

File menu - Add - existing project

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
AttilaBAuthor Commented:
Yes you are right, once I import the the DLL project to the executable solution, I get this if I try to build:

------ Build started: Project: Win32CppDLLExample, Configuration: Debug Win32 ------
Build started 1/31/2016 10:04:45 AM.
InitializeBuildStatus:
  Creating "Debug\Win32CppDLLExample.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  All outputs are up-to-date.
ManifestResourceCompile:
  All outputs are up-to-date.
Link:
     Creating library C:\Documents and Settings\user\My Documents\Visual Studio 2010\Projects\MyWin32CppApp\Debug\Win32CppDLLExample.lib and object C:\Documents and Settings\user\My Documents\Visual Studio 2010\Projects\MyWin32CppApp\Debug\Win32CppDLLExample.exp
Manifest:
  All outputs are up-to-date.
LinkEmbedManifest:
  Win32CppDLLExample.vcxproj -> C:\Documents and Settings\user\My Documents\Visual Studio 2010\Projects\MyWin32CppApp\Debug\Win32CppDLLExample.dll
FinalizeBuildStatus:
  Deleting file "Debug\Win32CppDLLExample.unsuccessfulbuild".
  Touching "Debug\Win32CppDLLExample.lastbuildstate".

Build succeeded.

Time Elapsed 00:00:04.09
------ Build started: Project: MyWin32CppApp, Configuration: Debug Win32 ------
Build started 1/31/2016 10:04:50 AM.
InitializeBuildStatus:
  Touching "Debug\MyWin32CppApp.unsuccessfulbuild".
ClCompile:
  Main.cpp
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(6): error C2871: 'Win32CppDLLExample' : a namespace with this name does not exist
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2065: 'MyWin32ClassOne' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2146: syntax error : missing ';' before identifier 'sc1'
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(12): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(13): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(13): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(14): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(14): error C2228: left of '.Setvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(15): error C2065: 'sc1' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(15): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2065: 'MyWin32ClassTwo' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2146: syntax error : missing ';' before identifier 'sc2'
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(17): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(18): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(18): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(19): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(19): error C2228: left of '.Setvar' must have class/struct/union
          type is ''unknown-type''
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(20): error C2065: 'sc2' : undeclared identifier
c:\documents and settings\user\my documents\visual studio 2010\projects\mywin32cppapp\mywin32cppapp\main.cpp(20): error C2228: left of '.Getvar' must have class/struct/union
          type is ''unknown-type''

Build FAILED.

Time Elapsed 00:00:01.16
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Open in new window


Some sort of namespace  problem?  I don't know how I would resolve it.

Now I have the 2 projects together:
Build problem
AndyAinscowFreelance programmer / ConsultantCommented:
This is now a totally different problem.
Please close this question and ask another.
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
C++

From novice to tech pro — start learning today.