how to run output.out file when I click on run (green triangle) in qt creator - qt-creator

I have output.out which is main.cpp but when I click project -> run I have problems with configuring it.
My command line arguments: Desktop/с/project/a.out
with no executable or working directory params and I have error because I need to set an executable in the custom run configuration.
Somehow I need to open it with a command, but I don't want to do it.

I solved the problem by clicking browse in 'executable' tab so the current path is /home/user/.../a.out

Related

run a bash script from build command of eclipse IDE on windows

I have a C/C++ project which is imported to an eclipse based IDE (STM32CubeIDE) on Win 11.
Inorder to compile the project, I have to enter some commands in git-bash. so for simplicity I wrote them into an .sh which is named build.sh and put it in the project folder, since then I just need to run this bash like this:
source build.sh
in git-bash, and here is its content:
#!/bin/sh
source Q:/stm32.sh
cd Q:/dev/my_project
make build_all
Right now, I want this script to be called, whenever I press the Build button of the IDE.
I found out that for this I have to change the build command from Propertise->C/C++ Build, uncheck the use default build command and then enter the proper command for running the script.
But I could have not do this by now.
I've tried to solve this problem by entering this
${workspace_loc:/${ProjName}/build.sh}
into the build command, which didn't work.
So my question is that what should I enter here to run the build.sh?
Do you know a better solution for my problem?

How do I change variables in the default environment in which applications opened from Finder run?

I noticed when I open an .app program in Finder, the environment variables are very different from when I open in terminal or zsh. As my eclipse-cdt:
In my Makefile, I use a GCC := i386-elf-gcc to compile my .c. > which i386-elf-gcc in terminal shows > /usr/local/bin.
When I open eclipse-cdt in zsh or terminal use shell command > open /Applications/Eclipse.cpp, I enter into my project and press build button. And it compiles perfectly.
However, when I open eclipse-cdt in my Finder, similarly click the build button, I got an error as follow:
make all
make: i386-elf-gcc: No such file or directory
make: *** [boot/bootmain.o] Error 1
I'd like to know how could I do it. And thanks for a buddy that he told me to ask the question. Link: How to use linux path in eclipse cdt?
Sincerely thanks!

How to Add, Build and Run existing files onto Xcode C++ Project Command Line

I am trying to add an existing folder to a project on Xcode. I want to run it on C++ OS Command line tool. I have added the cpp and hpp files on my project. On the Contacts folder, it includes a csv file and I have also included it on my project. The problem is that the program compiles and runs but it does not show any output of the contacts I was expecting to see.
Is there anything I need to do right?
Thanks for the help.
Contacts folder
Project on Xcode
Creating a new project as a Command Line Tool and using the same code called on main. Then try Activate Console command: Cmd+Shift+C or in the Top menu: View -> Debug Area -> Activate Console, then run your project Cmd+Shift+R or the play button shortcut on xCode.

xcode command line app - where is the executable code?

I'm writing a small command line tool/app in Xcode 6. After a steep learning curve (that I'm still climbing) I've got my code working in main.m without errors. My question is: does Xcode build some executable code that I can run from the command line inside a Terminal? I've tried "Build" and "Run & Build" but I don't see where any executable code is created. I'm very new at Xcode and need some help. I'm running OS X 10.9.5 and Xcode 6.1.1 on a Mac Mini.
If viewing my code would be useful, let me know and I'll put it up.
Thanks for any assistance.
Kevin H.
It's hidden very well. In Xcode 6, when you build an app, there is a folder "Products" in the project navigator (left pane). The name of your project will be there too. Right click, and select "show in finder". It will show you an obscure folder hidden deep in your OS X Library where the executable is located.
To copy the executable to a more convenient location each time you compile go into the project settings and select the Build Phase.
Type in a absolute location such as: ~/Documents/dev/temp. (It does recognize ~ as the current users home directory)
Then Press the '+' Button Under the 'Copy Files' Section and Select Your File (Select Your executable under the Products Folder)
Deselect the 'Copy only when installing' button. Then build and it should be at that location.
To launch just open the terminal app and go to that location. The executable should run unless there are dynamic libraries it calls that are not in the lib path.
Hope this helps
The binary is in a folder under /Users/Username/Library.
Something like:
/Users/<Username>/Library//Developer/Xcode/DerivedData/.../Build/Products/Debug/<ProjectName>
You can easily find it with this command:
find /Users/<Username>/Library/ -name "<ProjectName>"
replace "Username" and "ProjectName" accordingly to reflect your environment.
"Find" works, but you could also view the build log output and look for "CreateBuildDirectory" and copy the path from there.
Example below:
In Xcode 14 the path is nested under the line that says "Create build directory $(DERIVED_DATA_DIR)", but you can see the full path by expanding the icon on the right of the output.

Cannot compile Qt address book example on OSX

I have the sample address book project loaded up and it is failing to compile on OSX 10.6.8. Here is the output I am getting:
No valid Qt version set. Set one in Preferences
Error while building project part1
When executing build step ‘QMake’
Canceled build.
I click on the Projects tab on the left and I scroll to the “General” section, and I click on “Show Details”. I see the “Qt Version” is set to “Default Qt Version (Qt in PATH)”. I click on the manage button and it shows me that the version it is using is in /usr/bin/qmake. So I got to the terminal and I type “/usr/bin/qmake” and I get the help output. What am I missing?
Edit: Some additional details:
I can use the terminal in the project's root directory to run the command 'qmake part1.pro -spec macx-g++ -r' which is defined under the Projects tab in Qt Creator. It produces no output, which leads me to believe it worked correctly.
I then run the listed make command which is 'make -w'. I receive:
make: /Developer/Tools/Qt/uic: No such file or directory
make: *** [ui_addressbook.h] Error 1
make: Leaving directory `/Users/jsmaupin/part1'
When I check, the Qt directory does not exist under /Developer/Tools. However, there is a directory at /Users/[user directory]/QtSDK, but it does not contain anything named 'uic'.
I know I asked this a long time ago, but I saw this on my profile and I just wanted to post what my solution was. The problem stemmed from the Qt installation. There was an error dialog which I had ignored.
Qt requires XCode's command line tools in order to install on the Mac. If you open XCode and go to Xcode > Preferences > Downloads > Components, you'll find a list of installable packages. Click install on Command Line Tools and let it install.
Then, try to install Qt once more. It should work without any problems.

Resources