How do I get my .exe files to work? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How do I get my .exe files to work?

I made a nifty little program that converts fehrenheit temperatures to celsius (I know...not all that wonderful, but i'm proud cuz i just started learning 2 days ago).

I wanted to send it to my friend, but when i saved the .cpp file as an .exe and tried to run it, i got an error message saying that degree.exe (my program name) is not a valid Win 32 application.


This book I have on C++ says that one of the reasons C++ is useful is because you can send the programs to people and they don't need the language on their comp...they can just run it.


Am I doing something wrong? Is my computer messed up? Did I spend a good chunk of money only to be able to write up little bits of code that will never be able to be turned into real programs (Like some cheesy, two-bit shareware demo) ?? ;)


Penance




Comments

  • : I made a nifty little program that converts fehrenheit temperatures to celsius (I know...not all that wonderful, but i'm proud cuz i just started learning 2 days ago).

    : I wanted to send it to my friend, but when i saved the .cpp file as an .exe and tried to run it, i got an error message saying that degree.exe (my program name) is not a valid Win 32 application.




    The .cpp file is source code. It is not an executable. It never will be on its own. You need to compile the program with your compiler. By doing so, you can produce (amongst other things) an executable. This executable is not the .cpp file. It is an entirely separate file that your compiler must generate for you. If you've already run the program from the compiler, chances are the executable exists somewhere in the folder that your project is in.




    : This book I have on C++ says that one of the reasons C++ is useful is because you can send the programs to people and they don't need the language on their comp...they can just run it.




    Well, that's provided that you've compiled it for their platform. If you toss an executable from an IBM PC at a Mac box, or a Mac executable at a Linux box, there's no guarantee it will work. It's a double edged sword. You *should* be able to get it to run on another machine in the same machine family as your own, though. Find the actual executable that your compiler generated (not your own personal attempt to turn the .cpp file into an executable) and give that to your friend.



    : Am I doing something wrong? Is my computer messed up? Did I spend a good chunk of money only to be able to write up little bits of code that will never be able to be turned into real programs (Like some cheesy, two-bit shareware demo) ?? ;)




    Nope, you're just doing something wrong. No big deal. It's just that the source code will always be the source code, even if you just change the filename extension. You must get your compiler to generate a real .exe executable for you. Which you've probably already done without realizing it.



    : Penance


    Good luck! =)




  • I understand how this confusion could happen, but I'd like to state that questions

    like these are why I'm glad I don't work tech support.


    URL:http://acheronx.resnet.tamu.edu

Sign In or Register to comment.