2

I am using CodeBlocks as my IDE for a c++ console application. I got a new computer and installed codeblocks with MinGW. I have been working for hours to try to generate an executable file and have searched through every subdirectory within my project, but see no file that ends in .exe. How can I create an executable in CodeBlocks?

I eventually want to run the .exe from the command line, if that matters. Also, my OS is Windows 10 and it's a 64-bit system.

I'm thinking it may be a problem with the compiler or linker? The program I wrote runs fine if I run it in CodeBlocks, but there is no .exe so it can be run externally.

I attached a photo of the files being produced.

Also, subquestion: what on earth is this applicaction file extension? I have never seen it before.

Edit: here's the build log:

-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

mingw32-g++.exe   -c C:\Users\me\Documents\Source2.cpp -o C:\Users\sarah\Documents\Source2.o
mingw32-g++.exe  -o C:\Users\me\Documents\Source2.exe C:\Users\me\Documents\Source2.o  -static-libstdc++ -static-libgcc  
Process terminated with status 0 (0 minute(s), 5 second(s))
0 error(s), 0 warning(s) (0 minute(s), 5 second(s))
  • “what on earth is this applicaction file extension?” - Which file are you talking about? The generated file should either be main or a file in the bin folder. Edit your question to provide the necessary clarification required to answer your question – Ramhound Jan 21 '19 at 02:13
  • @Ramhound see the attached file. under type, the one that says "application" – chthonicThreat Jan 21 '19 at 02:45
  • @Ramhound also, it would help to specify what info might be helpful. this may come as a surprise to you, but i cannot read your mind. – chthonicThreat Jan 21 '19 at 02:49
  • So, I would strongly suggest you change the option [show file extensions](https://www.thewindowsclub.com/show-file-extensions-in-windows). The default of hiding known file extensions is ... questionable, to say the least. Once you've changed that option, you'll probably find that the "Application" type is just a friendly name for `.exe`. At least that's what the icon looks like. – Bob Jan 21 '19 at 03:01
  • @chthonicThreat - I can’t read your mind. I asked which file extension your asking about. Your screenshot doesn’t help clarify anything. – Ramhound Jan 21 '19 at 03:38
  • *Source2.o* is an object file and perfectly normal when compiling C++ applications – Ramhound Jan 21 '19 at 03:40
  • @Bob thank you so much. exactly what I needed. it is .exe. That seems like a silly setting, but very important to know. – chthonicThreat Jan 21 '19 at 05:25

1 Answers1

0

In case anyone else finds this helpful, here's the knowledge that helped me solve the problem.

  • As @Bob gracefully pointed out, Windows 10 has a setting that hides file extensions. But you can uncheck this option from the control panel. Turns out "Application" just means an executable.
  • Since the .exe still didn't execute from the command line, I referenced the top answer to this question, and, voila, the linker is happy enough to run the executable from the command line.
  • Note that the default hiding of extensions has been a thing since 7, probably earlier (I can't remember what it was in XP?). It's not new to 10. 10 does, however, expose an easier way to change the setting under the new Settings app, Developers section (which has one button to change some 5 options to more developer-friendly defaults). – Bob Jan 21 '19 at 08:19