I can't find the .exe file that qt-creator is supposed to be making - c++

This is my first time using Qt-creator and I just got done coding my program and I want to put it on a USB and use it on a different computer but when I go to where my project is located at C:\Qt\Tools\QtCreator\bin\Calculator
I don't see any .exe files the only files i see are a
1 .pro file,
2. another .pro file,
3 .cpp file,
4 .cpp file,
5 .h file,
6 .ui file,.
I have built the project in Qt-creator and everything runs fine and my program works without any errors when i run it inside of Qt-creator. I do not have a debug or release folder like some people say I should.
so my question is, where can I find/create the .exe file for my project?

Most probably you have done a shadow build, that means you build isn't located at your source.
You can find out where your build is located when you open the Projects Mode in creator. On the top should be marked your project. Then select the Build & Run tab. Select your Kit and switch to the build settings. Locate the Build directory in the opened page.
That should be the location where your binaries are build.

Related

Resource File is not created from Visual Studio

I'm currently writing AddOns for ArchiCAD.
Since .sln projects work with absolute paths, we wanted to try to have the same folder structure on every PC so we can share our projects with each other.
Example: Project for Room Numbering AddOn
I created a project under C:\workspace\ArchiCAD\AddOns\RoomNumbering
and the total path for every file is now C:\workspace\ArchiCAD\AddOns\RoomNumbering\...
and now everyone should be able to copy the folder structure and place the complete project folder in it and work with it.
I did this and tried to build the project on a different Computer.
When I open in vsc it finds all the files and external dependencies, but when I want to built the Project it hits me with an error:
FATAL ERROR LNK1811: cannot open input file "C:\workspace\ArchiCAD\AddOns\RoomNumbering\Build\ResourceObjects\RoomNumbering.res"
But this is a file that is supposed to be created during the built.
This is how it looks on my own Computer pre and after built.
The folder in question pre built:
The folder in question after built:
On my own Computer it creates the .res file, on other computers it does nothing (no new files get created after building).
I tried to build the Project first and then share it, so the .res file already exists. While this works, this isn't the desired way, since it still throws errors.
If it is relevant:
The projects get created by downloading the ArchiCAD AddOn Template (https://github.com/GRAPHISOFT/archicad-addon-cmake) and built it with CMake.
Does anyone know why vsc behaves that way or what I am doing wrong?
Thanks for any help and Kind Regards
Dayiz

How to include a library in my code using cmake?

I have tried to ´make´ the library yaml-cpp, not sure I did it right, but how do I build it?
In the tutorial (https://github.com/jbeder/yaml-cpp/blob/master/README.md) it says to run cmake in the build dir, but cmake could not find the cmakelist file, so I did it in the source dir, but then what? How do I build it?
If someone could make a newbie step by step to get the library (or any library really) so I can include it in my code, that would be awesome.
Im using Windows 7, and compiling using terminal (using Codeblocks MinGW gcc/g++) and sublime text 3 editor.
Edit: I have not "make". How can I get this?
Here is the step by step guide:
For the purpose of this answer I will use cmake gui instead to highlight a few key points.
go to https://github.com/jbeder/yaml-cpp and download the root library.
open cmake gui and select the source directory as <my project>/yaml-cpp-master
select a directory for the build. I would call it <my project>/yaml-cpp-master/codeblocks_build
press configure and then check all the values.
press generate and wait for it to complete.
Find the generated codeblocks project file within <my project>/yaml-cpp-master/codeblocks_build
Compile the project as you normally would.
find the generated DLL files and link them to your project.
The reason why you are getting this error is because cmake is trying to find the source code in the directory build which is newly created as seen in the tutorial:
mkdir build
cd build
This is meant to specify to cmake where to build it in rather than where to build from. If you wish to use it via a command line you will need to tell cmake where to build and where the source is.
To then call the functions from that library you will need to link the header files (files that start with .h or .hpp) and the DLL libraries.
the .cpp .c etc is where the implementation is but .h .hpp is where the definitions are.
So when you are including like this: #include<something.h> you are including definitions which are later filled by the .cpp files however in case of a library they are instead filled from .dll or .o

Visual Studio looking for a file in the Desktop directory instead of the Project Directory [duplicate]

I've got an a project (native C++ compiled to .exe) that runs fine outside of VS 2010, but inside of VS (with or without the debugger) it gets stuck trying to find a text file located in the same bin folder as it.
Any ideas as to why this would happen? My hunch is that VS messes with where the code looks when trying to open a file, but I don't know enough details to correct this.
Some details:
My .exe calls a function from a .dll I wrote earlier, which in turn tries to find a text file specifying that function's parameters. For convenience I've placed all of these files in the same folder, so finding the text file wouldn't be a problem.
Before opening the file, the function checks that it exists using:
PersistentAssert(Utility::FileExists(Filename), "Parameter file not found");
In VS 2010 this line causes "Parameter file not found" to display, but outside of VS the program manages to find the file.
When launching an executable from visual studio by default it uses the project file directory as the current working directory. You can change it in Configuration Properties -> Debugging -> Working Directory.
However I don't think it's correct behavior to search your programs datafiles etc from the current working directory. Instead your program should find out the directory of the executable and find the files in that directory.
Processes have the concept of a "current directory", which may or may not be the same directory as where the .exe file is located. It sounds like when you run your program inside VS, the current directory is something other than where your .exe is.
Somewhere in the project settings, there should be a place where you can choose what directory will be the current directory when your program starts inside the debugger. Set that to the same location as your .exe and you should be good.

How to make .exe file in Qt Creator

I was working on Qt Creator compiler to make a simple text editor. I did that but now want to make an .exe file of that project, but I don't know how to make an .exe file in Qt Creator compiler. Can anyone help?
There is a tool that adds the .dlls automatically on windows.
In the command prompt navigate to your qt bin directory. It should look something like this: ...\Qt\5.9.1\msvc2017_64\bin\ (I'm using visual studio).
Run windeployqt.exe in the command prompt with your project location as the argument like this:
windeployqt.exe C:\project_folder\my_project.exe
Now my_project.exe will have the .dlls in the same directory and will execute.
The executable is generated by the compiler when you build your application. To know where the executable is stored, look into
Projects (CTRL+5) -> Build settings -> General -> Build directory
This is where Qt creator will put the .exe it generates if you have shadow build enabled.
If shadow build is disabled, the executable will be stored inside the project folder itself.
From:
How to create executable file for a Qt Application?
Basically you have to look for MinGW subfolder deep into Qt tree, where Qt utilities reside, and copy needed dll's.
These are the steps I follow, based upon Qt 4.7.4, for packaging the application with correct shared libraries.
Let's say you've installed Qt under c:\qtsdk.
Open your project, and compile it in release mode.
Go to this directory: C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin -- it contains all shared libraries. Debug libraries end with a "d" -- frex, QtCore.dll is release version, while QtCoreD.dll is debug version.
Copy at least these files into your release directory (where your .exe lies):
mingwm10.dll
libgcc_s_dw2-1.dll
QtCore4.dll
QtGui4.dll
I just built, tested and deployed a dummy project this way.
I had the same problem so I used the suggested above answer:
"
There is a tool that adds the .dlls automatically on windows.
In the command prompt navigate to your qt bin directory. It should look something like this: ...\Qt\5.9.1\msvc2017_64\bin\ (I'm using visual studio).
Run windeployqt.exe in the command prompt with your project location as the argument like this:
windeployqt.exe C:\project_folder\my_project.exe
Now my_project.exe will have the .dlls in the same directory and will execute.
"
but there somethings that I did so this might help:
there is already an executable version of your app in the debug file of your project if you can't find it try to enter properties in Qt creator an track down the file. while you are at it in properties you can also see whether your app is using msvc2017_64 like in the previous answer or other compilers.
Take that file to the same path you write in the command line here: windeployqt.exe C:\project_folder\my_project.exe.
when your try to open the executable file it will till it needs some dlls files that you can find in this path .\Qt\5.9.1\msvc2017_64\bin copy and paste them in the location of the exe file
Steps to make an exe file from your qt project
In Build Settings make sure Edit build configuration is Release.
In Build Settings uncheck Shadow build(this will make sure that the release folder is inside of your project directory instead of outside of your project directory).
Build and run you project(This will create a release directory inside of yours project folder).
Copy *.dll and *.exe file from C:\Qt\6.3.2\mingw_64\bin to the release folder (where your projects exe file is there).
Copy all folders from C:\Qt\6.3.2\mingw_64\plugins to the release folder.
Now you can launch the exe file inside of your release folder corresponding to your project.

visual studio 2013 deploy a project

I crack my head already, I need to deploy a project. I tried to use InstallShield, it create an msi file, and local installation has no errors, but then when I tried to launch the program it output "debug error". In my settings code generator -> runtime library set for Multi-threaded Debug DLL(/MDd). If I'll set it to Multi-threaded (/MT) it would not compile: "Please use the /MD switch for _AFXDLL builds"
Then I tried to use VS Installer project extension. It creates the msi and setup file, but after I install it, I can't find the .exe file and launch program. What I am doing wrong?
Folder with project files
![enter image description here][3]
Folder with exe file
![enter image description here][4]
At the stage of creating the installer for your program, you have to put all the external files, libraries and resources, that your program needs in order to run correctly, in your program's working directory. When you run the program via Visual Studio, everything works fine since it can find the files, because, as you've mentioned, they are in the project folder, and the project folder is where Visual Studio is looking for them.
When you launch your program outside VS, the program can't find these files since it by default tries to locate them in the folder in which the .exe file being run is located. So, if you wan't to run program outside VS, you need to put all the files needed to your .exe's directory.
For the same reason, while creating your installer, you need to include all the files necessary in the installation target directory together with your .exe. Every installer creator lets you do that.
In general, if you cannot run your program outside any IDE, and you can run it within that IDE, it is a rule of thumb that you should first check if you have included all the necessary files/libraries/dll's/etc. in your program's working directory.
I solved it!!!!!!!!
1)Help to run .exe file, helped updating .uld file in the same directory as a exe file.
2)I used Dependency Walker (http://www.dependencywalker.com/) to find all dll that it's need. And then I create a Setup Project using Wizard at the "Choose file to include" step I add every file and every library that it's depend on! Build->Install-> Then magic, and my application installed and running! Thank you all for your help