We help IT Professionals succeed at work.
Get Started

Making a Sample Win32 DLL project Using Visual Studio 2010 Professional

AttilaB
AttilaB asked
on
380 Views
Last Modified: 2016-01-31
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.
Comment
Watch Question
Freelance programmer / Consultant
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE