Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have recently written a fairly simple code for windows app, a 2048 game, including some basics such as icon, background and stuff, 4 buttons for different directions and 4x4 array of static windows for output. The Code isn't really "nice" but as I'm still learning I find it enough since it work ( at least on my PC ). I'm using default VS13 config, haven't changed anything after I installed it and the code is written in c++.
Codes can be found here: https://www.dropbox.com/sh/15y1daq2h3jm8p7/AADp0m1EfUJo3W2z315Zgd0Wa
Now what bugs me is that the program compiles with 0 warnings or errors and works just as I intended it when I run it either via debug or from desktop on my PC, but when I upload it to dropbox and want to start lets say on laptop then it doesn't work.
Also if I try to compile the exact same code in Codeblocks I can't and there are warnings that many functions weren't declared in the scope.
Can any1 explain why is this happening and how can I fix it ?
The basic problem you are facing is that you are trying to compile the code outside of the Visual Studio environment for a VCPP code that you have written.
When you debug the code using Visual Studio, all the required files/dependencies are injected during compilation.
I'd recommend packaging the code using Visual Studio and try running the exe on your laptop.
Make sure you have the correct version of VC++ runtime environment installed on your target machine. (You can optionally also include the setup with your packaged setup.)
From here: https://stackoverflow.com/a/20890610/1477051
As you can see here, the MSVCP DLL is the platform's
implementation of the C++ Standard Library. In short what that means
is you cannot distribute your application without needing the "stuff"
that these libraries provide. All compilers regardless of platform
would need some kind of implementation of the Standard Library.
Typically this is distributed in the form of libraries.
However you can distribute your application so that the "stuff" is
built in to your program directly, rather than being shipped in a
separate DLL. In order to do this, you must statically link your
application to the Standard Library.
There are a few ways to accomplish this. One way is in Project
Settings. In "Configuration Properties" > "C/C++ Code Generation" >
"Runtime Library", choose "Multithreaded (/MT)" as opposed to
"Mutithreaded (Static)".
By the way, the "D" in "MSVCP120D.dll" you mentioned above means
"Debug." This means that you are trying to distribute a debug build of
your program. You should (almost) never do this. Distribute release
builds instead.
Related
This question already has answers here:
Can I program for Macs without owning one?
(3 answers)
Closed 3 years ago.
Recently I have been working on creating a game using Visual C++ 2017 and SDL2. I want to make my game accessible to users on all different kinds of systems, not just Windows. I tried starting with making my game also usable on Mac OS, but I cannot figure out any ways of doing this. I figured the best method would be to get Visual Studio to compile my code into a file type like ".APP" rather than ".EXE" since I don't own any form of Mac or Apple computer that can use software made to create apps for Mac. However, I cannot figure out how to change the options in Visual Studio to compile the code into a different file type or even if doing so is possible.
I've searched all over the internet for methods of converting ".EXE" to other file types, using different C++ compilers for compiling into Mac-compatible files, etc. but I haven't been able to find anything that works without requiring a virtual machine or having a physical Mac computer (neither of which I've tried yet since it would take a lot of effort and I'd like an easier solution).
If anybody could tell me how to change the type of file that Visual Studio compiles your code into or if they could suggest a different compiler that works on Windows, is compatible with SDL2, and can compile C++ code into file types that work on Mac computers like ".APP", that would solve my problem. Thank you in advance!
You need to compile your code on all the different platforms you want to support. Using a compiler supported on each of those platforms.
Code compiled on one platform can not run on another (except cross compiling, see below, but that's painful).
Cross compiling is an option on some platforms and with some compilers, but it's usually more pain than gain if you can in any way set up a local tool chain. Cross compilers generate code for a different platform than you are currently running, but getting that working can be hard. And you then also have no way to test your code on the target platform (unless you have one, in which case native compiling would just be easier in the first place).
You should automate the building of your code on different systems with different compilers in your Continuous Integration systen (CI) btw. So you always know after you push a commit, on what platforms it fails and why.
Easiest way forward (IMHO): Buy a cheap Mac. Buy a cheap PC and install Linux on it. Setup a CI system to build all code you commit to your code repository on all your systems (Windows, Mac, Linux) and make it scream at you when the build fails. Also use that system to build installable packages for each platform and again, scream when that fails.
Do the same for all your unit tests.
That's the only serious way to go forward supporting multiple platforms.
This question already has answers here:
Standalone VS 2010 C++ Program
(5 answers)
Closed 7 years ago.
I'm trying to compile my c++ program I wrote without using .NET Framework (I needit to be, at the end, an EXE file).
These are my includes:
stdio.h, tchar.h, windows.h, string.h, iostream, thread, Wbemidl.h, memory, algorithm, WinHttpClient.h, functional , cctype, locale.
When I try to compile and run this program in VS (adding the stdafx.h) the program works just fine, but it compiles with the .NET framework.
How can I compile it without the .NET Framework? Is it even possible? (I believe it is but I'm asking anyway).
I tried to use both mingw32 in Ubuntu and code::blocks in windows. Maybe I'm doing something wrong?
Thank you.
Edit:
This question is not the same as the question you marked mine to be similar to.
I can't and I don't want to rely on the fact that the destination computer has redistributable packages or .NET or some MSVCP. In the end, this program should work on Windows XP and above and on most of the Linux distributes.
Please, I need your help. I might said something wrong earlier in this topic, and I'd like you to explain me my mistakes and also, I still need your help to compile this.
I tried to change the settings you told me on VS, to /MT in the code generation settings, but it gave me even more errors that it cannot open some source files, which makes even more error.
I thought about leaving VS 2015 and move to code::blocks on Ubuntu, even compiling with the MingW32 itself, but it writes me "undefined reference to..." 49 times (all the functions defined in the header files I included).
I'd really appreciate any help.
Do you actually know, what the difference between .NET and WinApi is?
If you plan to code without .NET you should have a look at win32developer.
An alternative would be to use Qt, which I warmly recommend you to use.
.NET provides many functions for networking and window handling etc. like Java but it is WINDOWS ONLY and since you don't want to depend on .NET you have to either implement it yourself or get another package like I suggested above.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
A simple question, I have made a program that runs on my computer perfectly but not on someone else's computer. This simple question is a big headache of mine. I have read at least thousands of topics on the internet.
I tried to copy msvcp90.dll and other dll files to the target machine but that didn't work. I read an article which says you have to copy a manifest file too. Now I don't know which manifest file to copy.
I also have created my own dll file but that didn't work either.
Can anybody please help me, I'm in a big headache (I don't want to statically link the libraries, just tell me the concept of dynamic linking). Thank you.
One other thing, I have used windows.h header file in my program and a lot more header files. I am using visual studio 2008.
First, make sure you are compiling the release version of your application - typical users never have the debug c-runtime installed.
Second, you probably want to install the full c-runtime library on the client machine that corresponds to the version of Visual Studio you are using. Here's a link for the VS 2008 runtime: C Runtime Library
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am currently using Eclipse for C/C++ programming. Though i am accustomed to using eclipse for Java, i cannot figure out a good workflow for using Eclipse for C/C++
What i find lacking is a good debugging support. STL structures (vector, map) are not displayed in debug view as they are equivalently displayed in Java. They are displayed in a very obscure manner which is hard to interpret.
Upon googling i found
Better variable exploring when debugging C++ code with Eclipse/CDT
but i find the method not robust. It cannot display STL structures with objects (strings too) in them. Extending the .gdbinit file to support those will be an entire new project for me (as i am a new programmer)
Is there some other IDE good for C/C++ programming and debugging. Or is there something i am missing because certainly for such a industry standard language there must be some good
support out there.
EDIT: I am on a Win or *nix
I use visual studio express on Windows. It is free with alot of debugging functions.
1. Microsoft Visual Studio Express C/C++ (Best for Windows)
2. Code Blocks (Best of *nix)
3. Eclipse for C/C++
4. Netbeans
Hope this helps
On Linux I would prefer to use Code::Blocks
You can also look for NetBeans
GNU DEBUGGER
The C and C++ editor is well integrated with the multi-session GNU gdb
debugger. You can set variable, exception, system call, line, and
function breakpoints and view them in the Breakpoints window. Inspect
the call stack and local variables, create watches, and view threads.
You can evaluate a selected expression by moving the cursor over it
and viewing the tooltip. The Disassembler window displays the assembly
instructions for the current source file.
If your on a mac xcode is pretty good.
Embarcadero C++ Builder, also available as part of RAD Studio, is quite good, and has been undergoing significant development over the past couple of years.
It can be used to develop Win32 apps, Win64 apps, Mac OS X apps, as well as iOS and Android apps (the mobile OS's are only in the RAD Studio in the Delphi language for now, but C++ support is expected by the end of the year)
It has excellent debugging support as well. The IDE runs only on Windows, but does work quite well in a Virtual Machine running Windows inside a Mac, with either VMWare or Parallels. It does require a Mac, running Xcode, to compile Mac OS X or iOS applications -- that can be a separate computer, or the "Mother Ship" if you are running Windows in a Virtual Machine on the Mac.
I am used to Java and Eclipse, as that was what I first programmed with. That said, in Eclipse, when debugging Java, you can make code changes, and save them, while the code is running. The changes to the code will then take effect in the debug window, without a change to your code.
I am wondering if you can do the same thing, or similar with C++. I am currently using Code::Blocks, and I'm wondering if there is a debugging plugin for it that does the same thing, or similar. I know about Edit and Continue in VS, but I would really rather stick with Code::Blocks. Also, I have not programmed C++ in Eclipse yet, and will hot swapping C++ work in Eclipse? Or is that a Java feature?
What you're looking for is a feature of the entire toolchain, including the compiler, linker, loader, and debugger. Visual C++ has this feature because Microsoft has made all its tools work together to support it. Similarly, the same effort has been spent to make Java work this way.
As far as I know, Code::Blocks is just an editor but delegates the compiling and linking to other compilers (without specifically integrating with their features).
Java is JIT compiled (just in time, compiled at runtime) making this feature, perhaps not trivial, but not as significant a challenge as it is to implement in a C++ environment. I've been developing in Visual Studio for 10+ years now, and to be honest, I find edit and continue rather useless.
As to having it in Code::Blocks, gcc would have to support incremental compilation before this was put significantly on the agenda of many C::B users. There was a project to add this functionality, but I'd say at this stage, you're out of luck.