473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Build Problem - Debug Vs Release

Hi there,

I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for
the debug version of the DLL (and this DLL works fine), however, I seem
unable to build a Release version of the DLL. If I do a 'Batch Build' and
select both Debug and Relase versions for building it will build the debug
version but throws up errors for the Release version. For example, the output
I get for a Batch Build is this -

--------------------Configuration: DartmNowWebSvcs - Win32
Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
DartmNowWebSvcs.cpp
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cpp (109) : error C2491:
'ProcessData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cpp (344) : error C2491:
'FreeOutData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cpp (363) : error C2491:
'DisplayConfig' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cpp (417) : error C2491:
'GetDLLVersion' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cpp (450) : error C2491:
'GetDLLVersionH' : definition of dllimport function not allowed
DlgConfig.cpp
Generating Code...
Error executing cl.exe.

DartmNowWebSvcs.dll - 5 error(s), 0 warning(s)
--------------------Configuration: DartmNowWebSvcs - Win32
Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
DartmNowWebSvcs.cpp
DlgConfig.cpp
Generating Code...
Linking...
Creating library Debug/DartmNowWebSvcs.lib and object
Debug/DartmNowWebSvcs.exp

DartmNowWebSvcs.dll - 0 error(s), 0 warning(s)
I dont believe the code is wrong because I used the code from a template DLL
app and the template is written the same and gives no errors for a Release
build. Thus, it must be due to a link problem but after checking and checking
the Project Settings I can see no difference with the Settings? Unless I'm
missing a setting somwhere? Any advice offered much appreciated.

Thanks,
David


Nov 17 '05 #1
5 5322
On Thu, 21 Jul 2005 02:55:03 -0700, "David++"
<Da***@discussions.microsoft.com> wrote:
Hi there,

I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for
the debug version of the DLL (and this DLL works fine), however, I seem
unable to build a Release version of the DLL. If I do a 'Batch Build' and
select both Debug and Relase versions for building it will build the debug
version but throws up errors for the Release version. For example, the output
I get for a Batch Build is this -

--------------------Configuration: DartmNowWebSvcs - Win32
Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
DartmNowWebSvcs.cpp
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(109) : error C2491:
'ProcessData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(344) : error C2491:
'FreeOutData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(363) : error C2491:
'DisplayConfig' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(417) : error C2491:
'GetDLLVersion' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(450) : error C2491:
'GetDLLVersionH' : definition of dllimport function not allowed
DlgConfig.cpp
Generating Code...
Error executing cl.exe.
<snip>
I dont believe the code is wrong because I used the code from a template DLL
app and the template is written the same and gives no errors for a Release
build. Thus, it must be due to a link problem but after checking and checking
the Project Settings I can see no difference with the Settings? Unless I'm
missing a setting somwhere? Any advice offered much appreciated.


Not the linker. Those errors are generated by the compiler (cl.exe).

My guess it that there is an #ifdef that defines some symbol to be
__declspec(dllimport) or __declspec(dllexport) based on some other
symbol. Compare the C++ compiler Defined Symbols settings for Release
vs. Debug.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.
Nov 17 '05 #2
Hi Severian,

Your guess is correct. In the code I have the following #ifdef block -

#ifdef DLL_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

But how do I access the - C++ compiler Defined Symbols settings for Release
vs. Debug ? Are they somehwere in the Project -> Settings ?

Thanks for your help!

David

"Severian [MVP]" wrote:
On Thu, 21 Jul 2005 02:55:03 -0700, "David++"
<Da***@discussions.microsoft.com> wrote:
Hi there,

I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for
the debug version of the DLL (and this DLL works fine), however, I seem
unable to build a Release version of the DLL. If I do a 'Batch Build' and
select both Debug and Relase versions for building it will build the debug
version but throws up errors for the Release version. For example, the output
I get for a Batch Build is this -

--------------------Configuration: DartmNowWebSvcs - Win32
Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
DartmNowWebSvcs.cpp
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(109) : error C2491:
'ProcessData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(344) : error C2491:
'FreeOutData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(363) : error C2491:
'DisplayConfig' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(417) : error C2491:
'GetDLLVersion' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(450) : error C2491:
'GetDLLVersionH' : definition of dllimport function not allowed
DlgConfig.cpp
Generating Code...
Error executing cl.exe.


<snip>
I dont believe the code is wrong because I used the code from a template DLL
app and the template is written the same and gives no errors for a Release
build. Thus, it must be due to a link problem but after checking and checking
the Project Settings I can see no difference with the Settings? Unless I'm
missing a setting somwhere? Any advice offered much appreciated.


Not the linker. Those errors are generated by the compiler (cl.exe).

My guess it that there is an #ifdef that defines some symbol to be
__declspec(dllimport) or __declspec(dllexport) based on some other
symbol. Compare the C++ compiler Defined Symbols settings for Release
vs. Debug.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.

Nov 17 '05 #3
Ok, I've chnaged this code from -

#ifdef DLL_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

to just this...

#define DLL_API __declspec(dllexport)
and it seems to be working ok now. Now I will try and work out 'why' (the
tricky bit ;-)

Cheers,
David

"David++" wrote:
Hi Severian,

Your guess is correct. In the code I have the following #ifdef block -

#ifdef DLL_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

But how do I access the - C++ compiler Defined Symbols settings for Release
vs. Debug ? Are they somehwere in the Project -> Settings ?

Thanks for your help!

David

"Severian [MVP]" wrote:
On Thu, 21 Jul 2005 02:55:03 -0700, "David++"
<Da***@discussions.microsoft.com> wrote:
Hi there,

I have built a DLL in Visual C++ 6. When I build the DLL it builds fine for
the debug version of the DLL (and this DLL works fine), however, I seem
unable to build a Release version of the DLL. If I do a 'Batch Build' and
select both Debug and Relase versions for building it will build the debug
version but throws up errors for the Release version. For example, the output
I get for a Batch Build is this -

--------------------Configuration: DartmNowWebSvcs - Win32
Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
DartmNowWebSvcs.cpp
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(109) : error C2491:
'ProcessData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(344) : error C2491:
'FreeOutData' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(363) : error C2491:
'DisplayConfig' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(417) : error C2491:
'GetDLLVersion' : definition of dllimport function not allowed
H:\WEBSERVICES\DartmNowWebSvcs\DartmNowWebSvcs.cp p(450) : error C2491:
'GetDLLVersionH' : definition of dllimport function not allowed
DlgConfig.cpp
Generating Code...
Error executing cl.exe.


<snip>
I dont believe the code is wrong because I used the code from a template DLL
app and the template is written the same and gives no errors for a Release
build. Thus, it must be due to a link problem but after checking and checking
the Project Settings I can see no difference with the Settings? Unless I'm
missing a setting somwhere? Any advice offered much appreciated.


Not the linker. Those errors are generated by the compiler (cl.exe).

My guess it that there is an #ifdef that defines some symbol to be
__declspec(dllimport) or __declspec(dllexport) based on some other
symbol. Compare the C++ compiler Defined Symbols settings for Release
vs. Debug.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.

Nov 17 '05 #4
Hi David++!
Ok, I've chnaged this code from -

#ifdef DLL_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

to just this...

#define DLL_API __declspec(dllexport)
and it seems to be working ok now. Now I will try and work out 'why' (the
tricky bit ;-)


Yes, this works but now your program which uses your DLL (h-File) has
some trouble!

Please just define the "DLL_EXPORTS" in your preprocessor-settings!

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #5
I have just done this also! Phew, problem solved. Thanks for all your help!

Best,
David

"Jochen Kalmbach [MVP]" wrote:

Yes, this works but now your program which uses your DLL (h-File) has
some trouble!

Please just define the "DLL_EXPORTS" in your preprocessor-settings!

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
0
by: bnc mag | last post by:
Hello, Visual Studio 6 allows users to specify seperate post-build steps to perform on Debug and Release builds. I am trying to do the same thing in C#.NET 2003, but it appears as though I only...
4
by: whocares | last post by:
hi everyone. i'm currently experiencing a strange problem under vc++ 2005 express. i hope someone has a hint for me, i'm kind of lost atm. i'm using a vectors of pointers in my code. using...
3
by: Steve Franks | last post by:
I'm using Visual Studio 2005 RC and cannot figure out how to produce a "release" build. Am I doing something wrong? I'm wondering if perhaps MS locked out the ability to produce a release build...
7
by: Tom | last post by:
How can I make code not execute for a debug build, but do execute for a production build? I have code which prompts for an account and password when the program starts up. It is a pain to have to...
8
by: Bruce | last post by:
I am using VB in Vs2005. Am I missing something or does VB not have the concept of "builds" (release/debug) like in VC? I wrote an assembly and I would like to have a debug version of the DLL...
1
by: =?Utf-8?B?SlI=?= | last post by:
I have an MFC app that was originally built using VC++ 6.0. I have built it in both debug and release (both unicode) and run them both fine. I recently converted the projects to VC++ 7.1 and...
3
by: Bob Johnson | last post by:
It is my understanding - and please correct me if I'm wrong - that when building a project in debug mode, I can deploy the .pdb file along with the ..exe and thereby have access to the specific...
6
by: =?Utf-8?B?SHVnaA==?= | last post by:
Hi there We are trying to build a C sharp solution in Visual Studio 2005 Professional. We have a number of other assemblies, that do not form part of the solution. Assemblies that do form...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.