Geany fails to execute Cpp file following compiling with no error. File was vardef.cpp and compiled correctly with no errors, but when trying to execute, execute failed with the following message.
'"./vardef"' is not recognized as an internal or external command, operable program or batch file (exited with code 9009)
This has happened with other files with each message beginning with '"./filename"' This file is as follows:
// vardef.cpp #include <iostream> using namespace std; int index;
int main() { int stuff; int &another_stuff = stuff; // A synoym for stuff
stuff = index + 14; // index was initialized to zero cout << "stuff has the value " << stuff << "\n"; stuff = 17; cout << "another_stuff has the value " << another_stuff << "\n"; int more_stuff = 13; // not automatically initialized
cout << "more_stuff has the value " << more_stuff << "\n"; for (int count = 3 ; count < 8 ; count++) { cout << "count has the value " << count << "\n"; char count2 = count + 65; cout << "count2 has the value " << count2 << "\n"; } static unsigned goofy; // automatically initialized to zero cout << "goofy has the value " << goofy << "\n"; return 0; }
// Result of execution // // stuff has the value 14 // another_stuff has the value 17 // more_stuff has the value 13 // count has the value 3 // count2 has the value D // count has the value 4 // count2 has the value E // count has the value 5 // count2 has the vallue F // count has the value 6 // count 2 has the value G // count has the value 7 // count2 has the value H // goofy has the value 0
Any help would be appreciated. Regards, Paul
The second line of code should have shown #include <iostream>
This is the original code. Regards, Paul
In copy and paste from the Geany code page, the #include statement is only copying the #include but not the <iostream> which follows. The line two text in the original code is #include <iostream> Regards, Paul
Trying this again using the insert code function `#include <iostream>` This should be the correct in the second line of the code. Regards, Paul
This is a recorded message, please always provide the version of Geany, Glib and GTK (see lines near the top of Help->Debug Messages) and the operating system and version you are using.
And in your case what the compile and run commands and directories are configured to.
(@lynas685 fixed the code block, see [here](https://help.github.com/en/articles/creating-and-highlighting-code-blocks))
To confirm the code is valid, downloaded DEV-CPP 5.11 TDM-GCC 4.92 64 bit release and configured it for latest C++ *-11 and ran the same code unmodified. All *.CPP files compiled correctly and ran. Iostream.h worked correctly. So this DEV-CPP IDE system will work. DEV-CPP is not a small footprint compiler, requiring 343 MB of disk file storage, so Geany as installed on a Raspberry Pi is useful within it's limitations. Regards, Paul
@lynas685 make sure you configure the build command correctly (Build->Set Build Commands). It sounds like your executable is not being found by the OS when Geany tries to execute it. You can set the working directory for the "Execute" command in the "Set Builds Command" dialog (probably set it to `%p`).
@lynas685 Geany provides by default 2 separate commands for C++: "Compile" and "Build". "Compile" will only call the compiler to create an object file (`.o`) which is not an executable by itself but a compiled version of the file that can be used later on to create an executable (you can think of it like a kind of static library if you will). "Build" OTOH will try and create a complete executable, which sounds lie what you want. Make sure you use the correct one, and as @codebrainz mentioned, maybe check the commands are OK.
codebrainz, b4n, Thanks for the direction. I went into the Build pull-down settings and all working directories were blank. I filled all the full path to my working directories and now everything works correctly. All files compile correctly and execute. Many thanks. Glad to get this working correctly. Thanks again, Paul
Closed #2297.
github-comments@lists.geany.org