Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2015-02-10
6
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

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 31

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 20

Expert Comment

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

Accepted Solution

by:
sarabande earned 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

609 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