I've downloaded PhysFS and attempted to build it with Cmake. The option I
generated with is Code::Blocks makefiles, which generated a project file.
I supposed it was as easy as opening that project file and trying to build but
that didn't happen.
Upon building the project I get
-------------- Build: all in PhysicsFS ---------------
Using makefile: Makefile
Execution of 'make.exe -s -f Makefile all' in
'C:\Documents and Settings\Stefan.MONA-H6H4KPUJNF\Desktop\build' failed.
Nothing to be done.
I've tried checking out a similar question, but the options in the answer
were already good, and it didn't work.
I'm on windows XP SP3
Related
I have recently been trying to set up my CMake environment and some 'hello world' code in C++. I added a CMakeLists.txt and added my configurations, but when I ran cmake . in the command line, something was different from all of the tutorials.
The people on the tutorials were using a Unix based system, so the command cmake . was producing a 'makefile'. They then built the makefile using the command make.
Since I'm on windows, it generated a msvc .sln file instead of a makefile. My question is - how can I build the .sln file, similar to how they did it on Linux? I want to do it without Visual Studio 2019 and preferably in the command prompt.
I have tried searching for this question, but haven't found what I'm looking for. Thank you in advance.
First of all, you should never do an in-tree build with cmake .. It invites problems in the form of name clashes and makes it nearly impossible to get a clean rebuild.
If you're using a recent version of CMake (which you should be), the standard way to build a project varies on whether the backend generator is single-config or multi-config.
If it's single-config (like Make or Ninja), then the commands are:
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S /path/to/sources -B /path/to/build
$ cmake --build /path/to/build
The directory /path/to/build doesn't need to exist when you invoke CMake. If you wanted a Debug build, rather than Release, you would just replace that in the first line. You should never run a single-config generator without setting CMAKE_BUILD_TYPE.
If it's multi-config, like Visual Studio, then the commands are:
$ cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 -S /path/to/sources -B /path/to/build
$ cmake --build /path/to/build --config Release
The major difference here is that the config is specified in the second (build) command, rather than the first (configure).
I copied/paste a Qt5 project folder from a computer to another computer. They are both Ubuntu 18.04.
Same version of Qt5 and same libraries/dependencies. On the new computer, I have CMake 3.10.2, but I don't remember the verion of CMake I had on the former one. (Probably CMake 3.8).
As soon as I open Qt5 and open the folder containing the CMakeLists.txt file, and click on it, I get the following result from the output:
08:02:22: Running steps for project newcam-proc...
08:02:22: Persisting CMake state...
08:02:22: Starting: "/usr/bin/snap" --build . --target all error: unknown flag `build'
08:02:22: The process "/usr/bin/snap" exited with code 1.
Error while building/deploying project myProject (kit: Desktop Qt 5.12.5 GCC 64bit)
The kit Desktop Qt 5.12.5 GCC 64bit has configuration issues which might be the root cause for this problem. When executing step "CMake Build"
08:02:22: Elapsed time: 00:00.
And below the General Message I get:
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_armv7/mkspecs/android-clang/qmake.conf.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_x86/mkspecs/android-clang/qmake.conf.
Running /usr/bin/snap /home/emanuele/Desktop/myProject -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/home/emanuele/Qt/5.12.5/gcc_64 -DQT_QMAKE_EXECUTABLE:STRING=/home/emanuele/Qt/5.12.5/gcc_64/bin/qmake in /tmp/QtCreator-vlHbHY/qtc-cmake-LvUefYdh.
error: unknown command "/home/emanuele/Desktop/myProject", see 'snap help'.
CMake process exited with exit code 1.
I never had to use Android NDK on my previous project, nor I had to install it. And I am not sure why on the new machine is showing this message.
In addition it seems that is trying to use snap instead of the usual make.
I am not sure about what is happening and why.
What I tried so far:
1) The only thing that came to my mind was to try to create a small example application and see if it runs, it actually runs properly and gives no error as shown below:
08:16:00: Running steps for project untitled...
08:16:00: Configuration unchanged, skipping qmake step.
08:16:00: Starting: "/usr/bin/make" -j8
make: Nothing to be done for 'first'.
08:16:00: The process "/usr/bin/make" exited normally.
08:16:00: Elapsed time: 00:00.
It seems that the project that I copied/paste uses snap and if I create a new project, like a Qt Widget application, it actually uses make, exiting correctly in the output.
The flags --build . --target all are flags you typically see passed to the cmake executable, not the snap executable. This hints that your CMake environment is not configured correctly in the IDE on your new machine. I suggest following the QtCreator CMake setup instructions here to help get it configured:
To specify paths to CMake executables:
Select Tools > Options > Kits > CMake > Add.
In the Name field, specify a name for the tool.
In the Path field, specify the path to the CMake executable.
Select the Auto-create build directories check box to automatically create build directories for CMake projects.
Select Apply to save your changes.
This question already has an answer here:
Why isn't the command "cmake ." generating a makefile? [closed]
(1 answer)
Closed 3 years ago.
I am using cmake to build the project. I am new to c++ so there can be mistakes as i am unaware of how it internally works.
When i run cmake command in build directory then the response does not give any error. The output is as shown in next image.image after cmake command
Now when i go to the test directory then i see these files.
image of test directory
As i already said i don't know how it internally works but following some online tutorials i expect that there should be a make file but i'm not getting that.
Any help would be great for as i am stucked in this setup from 3 days.
This is what is want to do next:
First, standard build files should be created from
these configuration files:
cd test/ && mkdir build && cd build,
cmake ..
Note that you have to run these commands only once. Next, you can use your platform’s native build tools
for the actual building:
make -j10
And train a single decision tree or bagging classifier with:
./DecisionTreeTest, and
./BaggingTest,
If you have Visual Studio 2019 you will want to run your cmake (from the build directory) as
cmake -G "Visual Studio 16 2019" ..
and you will get a new configuration and .sln generated in your build folder.
From there you can open the .sln in visual studio, or run (in your build directory)
cmake --build .
to begin compilation of a debug build or
cmake --build . --config Release
for a release build.
I am not a C/C++ developer, I tried to google but I couldn't find anything about.
Trying to write a simple java port of Assimp, I modified the Main.cpp code runs fine but it doesn't stop at the breakpoint, I guess because I am not compiling in debug mode.
My steps:
cloned assimp
from terminal in the directory cmake -G "Unix Makefiles"
opened the project in Netbeans from "existing sources"
compiled
This is my project Debug Property:
I don't have any other configuration other than the "Default" one.
How can I solve?
Cmake based projects are configured using the cmake configuration. Instead of switching to debug / release configuration within netbeans - as usual for "default" C/C++ Projects - you have to set CMAKE_BUILD_TYPE variable accordingly.
Using command line:
Debug: cmake -DCMAKE_BUILD_TYPE=Debug
Release: cmake -DCMAKE_BUILD_TYPE=Release
You do not need to repeat the other flags like, -G ….
Alternatively use the CMake GUI.
To get the selectable build configurations you can create them your own (go to Build -> Pre-Build and add calls as above).
TIP
It's recommended to do an out-of-source build.
First of all, I know that this question already exists multiple times in Stackoverflow but the answers provided for all of them didn't solve my issue(See section "Solutions worked for others" at the end of this question).
I am using the Eclipse IDE(Juno) with CDT plugin and Cygwin installed in my Windows-7 64-bit platform.
I successfully compiled and run the Hello World 'C' program but the Hello World "C++ program" is having Launch failed. Binary not found error.
I am also having recipe for target project.exe failed error in my auto-generated makefile.
Error line in makefile: #echo 'Building target: $#'
Additionally:
In c/c++ build -> toolchain editor ->
Current toolchain : Cygwin GCC
Current Builder : Gnu Make Builder
Used Tools:
GCC Assembler,
GCC Archiver,
Cygwin C++ Compiler,
Cygwin C Compiler,
Cygwin C Linker,
Cygwin C++ Linker.
When I change Current Builder from "Gnu Make Builder" to "CDT Internal Builder" the recipe for target project.exe failed error disappears but the Launch failed. Binary not found error still exists.
And also I dont have MinGW installed.
Solutions worked for others :
Before running the project directly using the run command, first Build the project and then run.
I build the project every time before I run it.
Eclipse can't find or point to an .exe file but the exe file runs fine when run from windows explorer and the answer to it is add -arch i386 to miscellaneous under linker.
My build runs without error but not creating the exe file. So this doesnt apply to me
Project->Properties->C/C++ Build->Settings->Binary Parsers
set "Cygwin PE Parser" and/or " PE Window Parser" and alike.
Tried all of them with different combinations but did not work
I also did :
adding the cygwin install dir to the path variable
added all the includes folders needed for cygwin for both GNU C and GNU C++ in Paths-and-Symbols -> includes
Saved the project before building and then running
restarted eclipse again
checked if g++ is installed using which g++ in terminal
and so on.
What could be a fix to this problem? Or do I have to install MinGW (I tried already to install MinGW with the installer.exe they provided and it failed on downloading the files several times) and try again.
I couldn't find the solution. Please show me what am I missing here.
Thanks in advance.