I have a C++ program which I am compiling on a x64 machine running Windows 10 with g++ x86_64-win32-seh-rev2 v7.1.0, using the command g++ -g main.cpp. When I run my program, I get the error 0xc000007b. This is my code
#include <iostream>
using namespace std;
int main() {
cout << "Hello World";
return 0;
}
When I compile with this code
#include <stdio.h>
using namespace std;
int main() {
printf("Hello World");
return 0;
}
It works fine. When I run it in gdb, it runs fine.
I have seen other posts where there are dlls being used that do not support the architecture, but I don't think I am using any dlls in this application, unless they are being added by g++
Related
I'm trying to run a program that prints out "hello" just to see if I can get C++ to run on my machine (running Windows 10 Home and Visual Studio 17.0.5). When I compile the program, I get all kinds of errors that seem to point to files that I haven't even included in my program:
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "hello";
return 0;
}
screenshot of errors
I tried to compile my C++ source ( simple hello world ) on WSL Linux through VS2019 after installed g++ gdb packages in Ubuntu WSL, I could debug the code and get info on vs2019 env but when try to built it I get below error
( Maybe a manual how this remote, WSL Linux compiling work )
Object reference not set to an instance of an object.
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <cmath>
using namespace std;
inline void keep_window_open() { char c; cin >> c; }
int main()
{
cout << "hello from ConsoleApplicationC__!\n";
keep_window_open();
return 0;
}```
I created C++ console project in Eclipse on Windows 7. I wanted it to run in external terminal, so I configured External Tool as described here: LINK. The following code runs fine and shows "Hello" on the console:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
void foo() {
//queue<char> x;
}
int main() {
//vector<int> a;
//string t;
cout << "Hello World!" << endl;
cin.get();
return 0;
}
However, when I uncomment one of the lines above, external console refuses to work (program exits instantly). Program compiles successfully and runs in the internal console.
The variables do not have to be used, declaration is sufficient to stop excution. I assume, there is something wrong with the External Tool, as the internal console works normally (maybe I should add some libraries to working directory).
Any ideas?
unable to compile even the hello world programe
#include <iostream>
using namespace std;
int main(){
cout <<"hello world";
system("pause");
return 0;
}
Dev ++ clearly compiles to 16 bit architectures and they are deprecated and unsupported since exactly Windows Vista. So you clearly have to use a different compiler.
I downloaded Eclipse from Yoxos. This Eclispe includes: c, cpp, java etc..
However, when I opened a new cpp project with MinGW GCC Toolchains, and created a cpp file: hello.cpp, and wrote the following little program:
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
when I run the file, it said - hello.exe has stopped working.
However, When I changed the program to:
(first line in comment)
//#include <iostream>
#include <stdio.h>
int main() {
printf("dsd");
return 0;
}
It worked well!
and when I removed the first line from comment like this:
#include <iostream>
#include <stdio.h>
int main() {
printf("dsd");
return 0;
}
the problem was back.. :(
Someone, Help..?
Thanks in advance! :)
Build Console Output:
20:41:10 **** Incremental Build of configuration Release for project hello ****
Info: Internal Builder is used for build
g++ -O3 -Wall -c -fmessage-length=0 -o helo.o "..\\helo.cpp"
g++ -o hello.exe helo.o
20:41:11 Build Finished (took 610ms)