Terminal will not create .exe file for C++ file? - c++

I have attached image of my compiler. My cygwin terminal will not create .exe file for my C++ program? I do not see exe file in my project diretory. I have used cygwin to compile code before, so I do not understand why it does not work.
VScode does the same thing as well?
Does anyone know a possible solution?

I have found that the full version of Visual Studios works much better than VS Code for compiling EXE's. You can get it for free here: https://visualstudio.microsoft.com/vs/

Related

Visual Studio Code File not outputting

So i have made a simple Program that outputs the text "Hi!" in C++.
I'm using Visual Studio Code and it was working before. But the last time i tried to open the program after succesfully compiling it, it wanted me to choose a software to open the file. I accedentally chose QT, and deinstalled QT afterwards, because i didn't want it anyways and thought that might fix the problem. But no there is no output in the terminal.
Here is a screenshot of VS Code after trying to output the file:
https://imgur.com/a/FfeATTs
You are currently typing test.cpp in the terminal. This is the source code of the program and not the executable.
You should type test.exe in the terminal.

Debugging .exe file using VCEXPRESS and an existing Visual Studio solution

I have a .EXE file which I need to debug using VCEXPRESS using the code in an existing Visual Studio solution (.sln). Basically I trying to do something like this:
VCEXPRESS.EXE program.exe -use project.sln
I know I can do this
VCEXPRESS.EXE program.exe code.cpp
But then I may not be able to navigate through the whole code as VCEXPRESS only sees code.cpp. and also the .exe file contains the code in the solution plus some extra code. Is there is a way to achieve what I am trying or anything similar to it?
I would really appreciate your help.
I debug it using different VS versions. One workaround I could think of is using the /DebugExe, but it doesn't work if I use the Express version since it has many limitations in command line.
https://msdn.microsoft.com/en-us/library/ms241274.aspx
But if I use the VS2015 community version which was also free in command line, I could debug the specified executable file. Would you please use the high VS version like the community which is also free and it has much more features than express version.
If I have misunderstood this issue, please feel free to let me know.
I solved it. The solution is to open the VS solution and use visual studio commands to add the .exe file as an existing project. It will be something like this
VCEXPRESS.EXE solution.sln /COMMAND "File.AddExistingProject program.exe"
You can also open a source code file like this
VCEXPRESS.EXE solution.sln code.cpp /COMMAND "File.AddExistingProject program.exe"
This will open the solution and code.cpp in the editor, then add program.exe as an existing project and allows you to debug it.
I hope someone in the future finds this answer useful.

How to Compile C++ Code Using Vim on Windows?

First, I install Vim (Text Editor) in Typical type, on this Windows 7 laptop. And this user that I'm using is an administrator on this computer but couldn't open file in “Program Files” location for writing with Vim. So I change my :cd current directory to my $HOME.
Note: I already have installed Visual Studio Express for Windows Desktop. I just want learn how to use this.
Can I compile C++ code using Vim in Typical type alone on Windows?
If it's possible, then what's the process for compiling C++ code?
I have hello.cpp file but I can't compile it. I already use :comp gcc and :make and the output is: 'make' is not recognized as an internal or external command,
But when I use :comp msvc and :make, the output is: 'nmake' is not recognized as an internal or external command,
Now, what should I do? If it's not possible using Vim alone, how can I compile using Vim with the compiler on my VS Express for Desktop?
VIM is a great text editing tool,its like an awesome version of notepad.But it's not a compiler,neither has a build in compiler of itself.So In order to compile the program you'll need a separate compiler installed,like You can use MinGW.
See This :
How to use MinGW make with Vim on Windows
Vim is just an editor tool. To compile a program you need a compiler tool chain. The one that Visual Studio use is Microsoft Visual Studio C++ Compiler, so you could use it. Or install and use gcc.
The make file that you are generating is used by make utility to actually compile the code for you. There is a Windows version of this tool.
However I would suggest you to perform minimum steps to compile a c++ program manually for better understanding of the process:
Create source .cpp file -> Create object file with a compiler-> create executable with a linker
Good step-by step instructions for Visual c++ here
If you prefer to use gcc, these are good links how to install and use it on Windows.

CPP file runs, but doesn't work when compiled to exe

I have created a cpp file using Microsoft Visual Studio 2010 and Allegro. It runs perfectly fine in the Visual Studio interface, but when I compile it into an exe, it says:
"The program can't start because allegro-5.0.10-monolith-md-debug.dll is missing from your computer. Try reinstalling the program to fix this problem."
I am running the exe on the same computer I used to write the code and debug it, so it shouldn't be the fault of a missing dll. Should it? That doesn't make sense to me.... I have compiled other exes before, and they do run on other computers, and the Allegro one works just fine while it's a cpp file, but when the Allegro file is run as an exe, it says I don't have the monolith thing.
Why is the file failing as an exe, but not a cpp?
This is what worked for me:
When in Configuration Properties -> Debugging
- Add PATH=c:\allegro\bin;%PATH% to the Environment Variable.
I had the exact same error, the program was telling me that it couldn't find the monolith DLL file. What I had noticed is instead of PATH=c:\allegro\bin;%PATH% I had put PATH=c:\allegro\bin:%PATH%. The difference is not easy to spot.
I put a : instead of a ; between bin and %PATH%
it was an easy mistake, however it caused me about 3 hours of heartache to fix.

Tried to embed python in a visual studio 2010 c++ file, exits with code 1

I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().
I dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly.
But, why did it fail?
I am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.
Is there simple 'hello world' type example of the Py_Initilize code in the python sdk you can start with?
That will at least tell you if you have the compiler environment setup correctly, or if the error is in your usage.
Well, i finally found out what went wrong.
I did compile my python27_d.dll with the same VC10 as my program itself.
But my program is normally compiled as 64 bit executable. I just forgot to compile the dll for x64, too. I didnt think this would lead to such annoying behavoiur, as i believed i would get a linkr error then.