Solved

C++, Microsoft Visual Studio 6.0 - Compiler issue

Posted on 2008-10-27
15
1,291 Views
Last Modified: 2013-12-14
OK, probably an easy question.  I've got Visual Studio 6.0 installed, and some sample code provided to me, which SHOULD compile, since I haven't made any changes as yet.  The code given to me has an include folder, which I have added to my list of include folders.  When I compile, here is what I see:
--------------
Deleting intermediate files and output files for project 'ICAddSub - Win32 Release'.
--------------------Configuration: ICAddSub - Win32 Release--------------------
Creating Type Library...
Processing D:\Ext Toolkit\Samples\FactoryObjects\ICAddSub\ICAddSub.idl
ICAddSub.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
oaidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
objidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
unknwn.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
wtypes.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ocidl.idl
ocidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oleidl.idl
oleidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\servprov.idl
servprov.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\urlmon.idl
urlmon.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\msxml.idl
msxml.idl
Processing ..\..\..\include\icontrol.idl
icontrol.idl
Processing ..\..\..\include\IError.idl
IError.idl
Processing ..\..\..\include\IFaceRT.idl
IFaceRT.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\time.h
time.h
Processing ..\..\..\include\ISymbol.idl
ISymbol.idl
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
ICAddSub.cpp
ICAddSubObj.cpp
ICAddSubPPG.cpp
Generating Code...
Linking...
   Creating library Release/ICAddSub.lib and object Release/ICAddSub.exp
Registering Factory Object
The system cannot find the path specified.
Error executing c:\windows\system32\cmd.exe.

ICAddSub.dll - 1 error(s), 0 warning(s)
-------------
Here are the commands and output from the Custom Build tab:

Commands
--------------
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec.time > "$(OutDir)\regsvr32.trg"

Outputs
----------
$(OutDir)\regsvr32.trg

I'm stuck from here.  What should I be looking at next?
0
Comment
Question by:JasonGreff
  • 8
  • 7
15 Comments
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22820901
>>>> $(OutDir)\regsvr32.trg

It looks like it doesn't resolve the macros.

Could you add

echo $(TargetPath)

to verify that. If a valid path was outputted you might check whether there actually is a file to register there
0
 

Author Comment

by:JasonGreff
ID: 22821473
OK, so I have this new line in the response

\Ext Toolkit\Samples\FactoryObjects\ICAddSub

This is a valid path, just needs a "D:" in front of it.  Newbie here, where are $(TargetPath) and $(OutDir) set?
0
 

Author Comment

by:JasonGreff
ID: 22821598
By the way, using echo $(OutDir) gives me
.\Release

RegSvr32.trg doesn't exist anywhere.  It appears that I'm attempting to register it before it gets created?  Or am I missing something obvious here?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22821792
>>>> This is a valid path,
Ok, open a command window (dos box), change directory to the project folder and type

   regsvr32 /c "\Ext Toolkit\Samples\FactoryObjects\ICAddSub"

If I am right you should get the same error message "The system cannot find the path specified."

>>>> just needs a "D:" in front of it.
Is the project directory at a different drive than the \Ext Toolkit\... path?

>>>> echo regsvr32 exec.time > "$(OutDir)\regsvr32.trg"
That statement was supposed to stream the string "regsvr exec.time" to the file ".Release\regsvr32.trg". If you don't find such a file in .Release it most likely is because the regsvr32 failed before.


>>>> It appears that I'm attempting to register it before it gets created?
No, you try to register the result of the build what should be the ICAddSub.dll  or ICAddSub.ocx, or any other library. What I wonder is why the $(TargetPath) has no file extension?  Do you know what is the result of the build and can you check whether it was successfully built?

 

0
 

Author Comment

by:JasonGreff
ID: 22822118
I opened a command prompt and went to the following path:

D:\Ext Toolkit\Samples\FactoryObjects\ICAddSub

Then I typed in regsvr32 /c "\Ext Toolkit\Samples\FactoryObjects\ICAddSub"

The response is "Load Library("...") failed - The specified module could not be found."

OK, here's my directory structure.  I have a Workspace created within D:\Ext Toolkit\Samples.  Inside of that directory are multiple subfolders, but the important one is "FactoryObjects".  Within that are three more subfolders.  Each of these contains code for some classes that are built in the workspace.  One of these classes is ICAddSub, and within that subfolder there are both a release folder and a debug folder.  I hope this is enough detail for what you are looking for.

The end result should be ICAddSub.dll, which is not appearing in the "Release" folder, instead, it is one level up, in the ICAddSub folder.  And yes, each time I do a build the file date changes.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22822791
>>>> "Load Library("...") failed - The specified module could not be found."
That means that the ICAddSub was dependent on some dll or other library which wasn't available at this place. You could solve that issue by adding the path to the dependent dll to the PATH environment variable. I wonder why you now get a different message than in the studio. Can you check the paths defined in the settings at Tools - Options - Directories - Executables? The same paths should be added to the environment variable Path at system settings - system - advanced - environment variables.

Did you get the same message when repeating the build in the studio?
0
 

Author Comment

by:JasonGreff
ID: 22823233
My path in the OS environment variables is huge due to the large number of applications I have installed in the past.  However, there are some directories listed in the C++ directories that are not listed in my OS Path.  From the OS Path, I think the following are relevant.

%SYSTEMROOT%\SYSTEM32;
%SYSTEMROOT%;
%SYSTEMROOT%\SYSTEM32\WBEM;

From the C++ directories, the following additional paths are listed
D:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
D:\Program Files\Microsoft Visual Studio\VC98\BIN
D:\Program Files\Microsoft Visual Studio\Common\TOOLS
D:\Program Files\Microsoft Visual Studio\Common\TOOLS\WINNT

So you think I should add these directories to my OS Path?  I'm not sure what the dependent dll might be, but I would suspect it is not included in the sample code, it's probably a standard MS dll.
0
 

Author Comment

by:JasonGreff
ID: 22823558
I added the four paths to my OS Path environment variable, it didn't help.
0
 

Author Comment

by:JasonGreff
ID: 22823591
Oh, by the way, I went back and reread some of your posts.  I think what you were directing me to do was to attempt to register the dll, which is not what I tried the first time.  I specified the path only, not the dll.  If I open a command prompt, navigate to the location where the ICAddSub.dll is located, and type

regsvr32 /c ICAddSub.dll

It succeeds.
0
 

Author Comment

by:JasonGreff
ID: 22823797
Here's some interesting information.  I can change the Active Configuration between the release version and the debug version.  I get the same error either way, but the files that are touched are different.  See the attached pictures.  I did a compile of the debug configuration at 11:43 and a compile of the release configuration at 11:45.  Note that there is an ICAddSub.dll in the Debug folder but not one in the Release folder.  There is also an ICAddSub.dll in the main ICAddSub folder, and this only gets touched by the release compile, and not by the debug compile.
Pic1.bmp
pic2.bmp
Pic3.bmp
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 250 total points
ID: 22824463
>>>> If I open a command prompt, navigate to the location where the ICAddSub.dll is located, and type ...regsvr32 /c ICAddSub.dll It succeeds.

Yup, but the command in your initial post was

    regsvr32 /s /c "$(TargetPath)"

It would have the project directory as default where it invokes the regsvr32 and would try to register a path rather than a dll. Both couldn't work.

I would suggest to put all the commands into a batchfile and call that batch from Custom Build Step passing the variables as arguments.

You would replace all the current statements by

    call regICAddSub.cmd $(TargetPath)

and create a command file regICAddSub.cmd in the project directory like

@echo off
cd &1
if not exist ICAddSub.dll goto ERROR
regsvr32 /s /c ICAddSub.dll
if errorlevel 1 goto ERROR
goto END

:ERROR
echo regsvr32 /s /c ICAddSub.dll failed
echo.
goto END

:END







0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22824520
>>>> Here's some interesting information
The differences in the loction of the output dll is defined in the linker settings. Check the linker settings for Release and Debug and you will see that the output once is ./ICAddSub.dll and for the other it is ./Debug/ICAddSub.

I would suggest to change it for the release config accordingly (I already assumed it that way in the command file).
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22824564
>>>> I added the four paths to my OS Path environment variable, it didn't help.
Yes, the windows and windows\system32 folders are default with or without you adding them to Path or VC settings.

I only wondered why the regsvr32 had problems loading libraries when being started from the project folder. But that is no issue if you could register it probably from the right path.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22824573
>>>> you could register it probably

should have been properly.
0
 

Author Closing Comment

by:JasonGreff
ID: 31510581
So essentially what is happening here is that the location of the dll is not the same as the path that the regsvr32 application is operating by default.  I'm not sure why this code was structured this way, but this is a very workable solution.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

756 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