Solved

Why when I convert my solution from Debug to Release version, the program doesn't work anymore?

Posted on 2015-02-10
6
174 Views
Last Modified: 2015-02-11
I finally was able to get the C++ program to compile without any errors and was able to produce the output without any issues.  When I compiled it into executable and tried to run on an XP machine, I received a message indicating that it was not a WIN32 application.  I then created a new project and selected "Visual Studio 2013 - Windows XP (v120_xp)" as the new platform.  I also specified that this executable be compiled as a Release version.

Now when I try to run the program, I get errors for fscanf, strcat, strcopy, where I didn't before.  I changed the fscanf, strcat, and strcopy to the secure functions (i.e., functions ending with _s).  My program still does not work.  

I'm not a c++ programmer nor am I experienced in Visual Studio 2013.

Can someone tell me what I am doing wrong?  Why changing the program from debug to release would result in errors?  And how can I get the program to run in an XP platform?
0
Comment
Question by:CarmenMTorres
6 Comments
 
LVL 19

Expert Comment

by:n2fc
ID: 40600993
I am presuming it ran OK in debug mode...

Typical cause for this type of behavior is an uninitialized variable, which exhibits changed behavior due to stack changes when removing debug.
0
 

Author Comment

by:CarmenMTorres
ID: 40601039
Yes, it ran perfectly in debug mode.  Is there a way in debug, to catch the culprit that is causing the problem?
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 40601047
Hi CarmenMTorres,

probably your RELEASE build is a 64-Bit application or is built for higher Windows version (i.e. take a loot at http://blogs.msdn.com/b/dsvc/archive/2009/06/19/troubleshooting-not-a-valid-win32-application-error-at-the-startup.aspx).

ZOPPO
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 86

Expert Comment

by:jkr
ID: 40601093
>> Is there a way in debug, to catch the culprit that is causing the problem?

Check out https://msdn.microsoft.com/en-us/library/fsk896zz%28v=vs.110%29.aspx ("How to: Debug a Release Build")

>>  I get errors for fscanf, strcat, strcopy

Wait a minute, do you get these errors when building the release version or when running it? If that is during the run, what exactly are the messages?
0
 
LVL 19

Expert Comment

by:n2fc
ID: 40601115
Try running "lint" on the source to check for uninitialized variables...
0
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
ID: 40603705
the problems often were due to different properties of release and debug configuration.

unfortunately, visual studio allows you to do major changes to properties of the debug configuration while the properties of the release configuration remain unchanged.

the errors you encountered may be caused by a different 'warning level' and the option 'treat warnings as errors' which both could be found in the properties of the c/c++-general page for the debug and release configuration.

if the new calls to the 'secure' functions do not work, you may post the code here together with an error description. there is often a problem with the additional size argument which may not be available if only a pointer was passed as argument.

Sara
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now