Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22299

C++ Program Not Outputting Text in Windows Terminal Even After Successful Compilation With g++

$
0
0

So recently I've downloaded MinGW for my Windows laptop so I can use g++ to compile my personal C++ code, as I'm a CS student learning GNU utilities because long story short, it's what the curriculum wants me to do.

This is the code I'm having a bit of a tussle with (I know it's a basic hello world program, I made it for testing):

#include <iostream>using namespace std;int main(){cout<<"hello world!" <<endl;return 0;}

When I use this command: g++ -Wall helloworld.cpp -o helloworld, the code is compiled without a single error, and an application called helloworld is created in the current directory. However, when I run the application using ./helloworld in Terminal, it doesn't output any text.

I've compiled programs with Visual Studio before and they have outputted text fine.

Also worth noting is that when I used the command gcc -Wall helloagain.c -o helloagain on this C program I made below, the program actually outputs text when I run it.

#include <stdio.h>int main(){  printf("Hello Again.");  return 0;}

Can anyone tell me why this is? Did I install MinGW wrong? Did I forget to do something for g++? Did I screw up one minor thing on my computer that caused this whole mess? Maybe re-installing MinGW might work, but I'm not sure.


Viewing all articles
Browse latest Browse all 22299

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>