We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,240 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to make my C++ program executable on other computers

Hello! I've seen a thousand dicsussion about how to make an .exe file from your .cpp source code, but none of it seems to help me: since I have the .exe file, I just can't run it on any other computer. Can anybody help me out, what libraries should I copy with it, what can I change about it?

6
Contributors
8
Replies
3 Days
Discussion Span
9 Months Ago
Last Updated
10
Views
Katangka
Newbie Poster
3 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

I assume you mean MS-Windows operating system. It all depends on the program, compiler and libraries you used. When you try to run the program on another computer does the os give you some errors, such as missing DLLs? Some compilers let you statically link all libraries so that it doesn't require any DLLs other than standard win32 api functions. We have to know a lot more about your program and compiler.

Ancient Dragon
Achieved Level 70
Team Colleague
32,137 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,575
Skill Endorsements: 69

Microsoft Windows, yes. Btw I think I should mention that it is a very basic program performing some calculations, only one program, no header files or anything that complicated. The only error message I get on xp is that the program cannot be executed; on Vista it mentioned something like side-by-side configuration is incorrect. I work in Microsoft Visual Studio 2008. Libraries I used, i think you mean the #include <> thing, I only used iostream. If there's anything more I should tell, let me know (maybe the way I can find out the answer as well... ) Thanks for the eager response :)

Katangka
Newbie Poster
3 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

What kind of project are you using? Is it a standard win32 console app or are you using something differently?

NathanOliver
Posting Virtuoso
1,515 posts since Apr 2009
Reputation Points: 281
Solved Threads: 277
Skill Endorsements: 3

Does your code contain any pointers? It may be possible that if you don't initialise them, they'll just point at a random value, which may happen to be system protected, however I doubt that. Could you post your code? It would be much better that way.

Something you should try is using the "Run as administrator" and "Compatibility Mode" features. Also try to move only the cpp and recompile it there, if it works, then it's probably the compiler.

DrunkenCoffin
Newbie Poster
14 posts since Aug 2012
Reputation Points: -3
Solved Threads: 0
Skill Endorsements: 0

You want to make sure that you are NOT trying to execute the DEBUG version of your executable on machines not having Visual Studio (2008) installed, i.e. build and use the RELEASE version on such machines.

mitrmkar
Posting Virtuoso
1,834 posts since Nov 2007
Reputation Points: 1,119
Solved Threads: 399
Skill Endorsements: 8

I work in Microsoft Visual Studio 2008

Here is a link For MS VS 2010 how to make an exe file which works on other computers as well:

http://www.youtube.com/watch?v=AvrjQtFBJvk

MS VS 2008 should be similar.

misi
Newbie Poster
22 posts since Aug 2012
Reputation Points: 0
Solved Threads: 2
Skill Endorsements: 0

It's working :) Thanks for the help. The problem was (as the video explained as well) that the program was depending on the .dll files, so I just had to change something in the properties. Though I still have a problem with it, with the useful part of the program. It is supposed to choose a value from a list of values, the closest bigger value to its value. Can you please check the code, maybe you notice where is the mistake. Sometimes it works and chooses the value, other times it just won't. I think There may be something wrong with the declarations, but I'm not sure.
`for(i=1;i<=n;i++)

        if(I[i]<=km[0][0])
            ksz[i]=KSz[0];
        else
        {
            for(j=0;j<=18;j++)
                if (I[i]>km[0][j] && I[i]<=km[0][j+1])   
                ksz[i]=KSz[j+1];
        }

`
This is what I am trying to use, km[][] is declared as set of values from km[0][0] to km[0][16], and km[3][16]. km[][] is declared as double, having values with 1 decimal precision.

Katangka
Newbie Poster
3 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Is the data in ascending sorted order? If not then the program can't work.

why does the loop counter i start at 1 instead of 0?

ksz[i]=KSz[0];

Don't name your arrays like that because you will do nothing more than confuse yourself (and others) when read later. name kSz something else and make the name meaningful for what data it represents.

for(j=0;j<=18;j++)

That is reaching beyond the bounds of the array. The array only has 16 elsmenets, not 19. The loop counter should be: for(j=0;j<14;j++) (14 because of the j+1 in the next statement)

Ancient Dragon
Achieved Level 70
Team Colleague
32,137 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,575
Skill Endorsements: 69

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0811 seconds using 2.68MB