VS 2005 C++ Win32 project does not link DLL file -- newbie question

N

n33470

I admit I'm a newbie to C++, so this is probably just a basic problem.
I'm trying to create a standard, simple, win32 DLL with external
functions.

I'm using VisualStudio.NET 2005. I create a new project in VS using
the Visual C++ Win32 project template, and call it "MyComponentWin32".
In the Win32 Application Wizard that appears next, I choose
Application Type of "DLL" and click Finish.

At the bottom of the MyComponentWin32.cpp file, I put the following
function definition:

extern "C" _declspec(dllexport) int OpenDevice()
{
return(5);
}

Now, I rebuild the project. There is no DLL file built in the Debug
directory of the project. I expected to find a file named
"MyComponentWin32.dll" in the Debug directory, but there isn't any.
Is there some other settting, or something, that I need? My suspicion
is that the link step might be failing, but I'm not sure how to figure
it out.

Any ideas?

Here is the output window from the rebuild project step:

1>------ Rebuild All started: Project: MyComponentWin32, Configuration:
Debug Win32 ------
1>Deleting intermediate and output files for project
'MyComponentWin32', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>MyComponentWin32.cpp
1>Compiling manifest to resources...
1>Linking...
1>LINK : C:\dmdotcom\Solution
2005\dev\ComponentSample\Debug\MyComponentWin32.dll not found or not
built by the last incremental link; performing full link
1> Creating library C:\dmdotcom\Solution
2005\dev\ComponentSample\Debug\MyComponentWin32.lib and object
C:\dmdotcom\Solution
2005\dev\ComponentSample\Debug\MyComponentWin32.exp
1>Embedding manifest...
1>Build log was saved at "file://c:\dmdotcom\Solution
2005\dev\ComponentSample\MyComponentWin32\Debug\BuildLog.htm"
1>MyComponentWin32 - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
 
B

Bruno van Dooren

Now, I rebuild the project. There is no DLL file built in the Debug
directory of the project. I expected to find a file named
"MyComponentWin32.dll" in the Debug directory, but there isn't any.
Is there some other settting, or something, that I need? My suspicion
is that the link step might be failing, but I'm not sure how to figure
it out.

If there were linker errors you should see them in the output window when
you rebuild your project.
most likely you are looking in the wrong folder.

normally the solution itself will also contain a folder called 'debug'.
that is where the output targets of all your projects will end up by
default.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
N

n33470

Bruno,

Thanks...that's it. There is a debug directory created at the
solution level which holds the linked DLL files. I'll look at the
project properties and see if I can figure out how to put in the
project's debug directory instead.

I feel like a true noob now. ;)

--steve
 
B

Bruno van Dooren

Hi,
Thanks...that's it. There is a debug directory created at the
solution level which holds the linked DLL files. I'll look at the
project properties and see if I can figure out how to put in the
project's debug directory instead.

go to project properties ->general->output directory and change

$(SolutionDir)$(ConfigurationName)
to
$(SolutionDir)$(ProjectName)\$(ConfigurationName)

if you really want it that way.

the reason that there is an output dir at the solution level is that this
makes it easier if you also have an app in the solution that uses that dll.
that way they end up in the same directory so that the app always uses the
correct version of the dll, and you won't have to copy it manually or in a
post build step to the app output folder.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top