How can I set up a GTK+ Project in Code::Blocks if gtk doesn't have the right subfolders? - gtk

I'm following this tutorial on how to set up a GTK+ project on Code::Blocks 16.01. The link in Step 1 to download GTK+ doesn't work, so I instead did a "Open in Desktop" from the Gtk Github repository. When doing Step 3 and giving the path for the location GTK, I get this error:
The path you entered seems valid, but the wizard can't locate the
include directory. The wizard cannot continue.
When I look back at the repository, I see there is no "include" or "lib" subfolder that is needed to make the project. What can I do to setup the project if neither of those folders exist? I realize the tutorial was written in 2013, so maybe it's outdated. There is a 2015 YouTube tutorial about setting this up, but it seems more complicated with setting up environment variables and changing Code::Blocks "Global Compiler Settings", so I was wondering if this 2013 tutorial still works.

That tutorial has a lot of outdated info in it. It recommends GTK+2, GTK+ is now at version 3, moving on to 4, and you'll probably want to follow GTK's methods for installing and setting up instead of orienting yourself around Code::Blocks.
My recommendation would be to follow the GTK+ download instructions and the instructions on how to set it up and maybe these instructions on how to start, then begin making it work with Code::Blocks (for which you probably need to look at this question).
Also, with how much work it takes to set up Code::Blocks for GTK+3 anyway, you may consider using a different IDE.

Related

How do I use JavaFX in Eclipse 2021-06 JRE x86_64_16.0.2

There are a couple postings on this topic, but I can't get this to work with the latest version of Eclipse. I am using the JRE that comes with 2021-06, the one it puts in p2, x86_64_16.0.2.
I have tried various configurations of User Libraries, Maven dependencies, setting PATH_TO_FX, searching Eclipse Marketplace for JavaFX-as-a-plugin, e.g.,
How do I use JavaFX 11 in Eclipse? (2.5 years old)
https://www.javatpoint.com/javafx-with-eclipse
https://www.tutorialspoint.com/javafx-with-eclipse
https://gluonhq.com/products/javafx/
On a couple more elaborate examples, a couple builds had a scattering of missing methods, which I assume is due to JavaFX being somewhat in flux or instructions being quite outdated. I can get a simple Hello, World to build with javafx-sdk-17.0.1 as a User Library (what I'm doing now) and also some of the other configurations. When I try to launch Hello, World with various build-able configurations, I keep getting
Error: JavaFX runtime components are missing, and are required to run this application
Well, I was a bit too quick. I kept playing around, and adding quotes in the VM arg seems to work,
--module-path="C:\Program Files\Java\javafx-sdk-17.0.1\lib" --add-modules=javafx.controls
If the project is not a module project, the Used Library goes on the Classpath in the project properties, Libraries tab. If it is a module project, it goes on the Modulepath,and the following module-info.java file must be in the src with this minimal information:
module <myProject> {
requires javafx.controls;
exports <myPackageContainingFXAppClass>;
}
I just don't get it why people prefer to search half of the internet for tutorials instead of just consulting the official documentation first. Here it is: https://openjfx.io/openjfx-docs/#IDE-Eclipse It seems to be the best hidden secret that there actually is documentation for JavaFX that one could start with.
I just did the test. Googling for "javafx documentation" gives https://openjfx.io/ as the first search result.
I use --module-path=${PATH_TO_FX} --add-modules=javafx.controls.
Obviously PATH_TO_FX needs to be defined in Preferences->Run/Debug->String Substitution.

Allegro 5 - Cosmic Protector Demo

I'm new to C++ and Allegro 5 but have been able to follow tutorials online and am able to build and compile several smaller projects successfully.
I cannot however get the demo project named Cosmic Protector to run and would like to at least learn what is wrong.
Unfortunately, I can't give you much to go on.
A window opens briefly and then closes, leaving the console open with the message..
process 6400 exited with code 255
If you have this demo running in VC 2017 with the latest release of Allegro 5 (5.2.4) installed via Nuget, I'd like to know that even.
The source for this program is available at...
https://github.com/liballeg/allegro5/tree/master/demos/cosmic_protector
Thank you, Jack
The allegro example programs and demos are usually built with CMake alongside the Allegro library. I just tested the CMake build of Allegro 5 with VS2017 on Windows 10 and it builds the Cosmic Protector demo successfully. You have to move the allegro dlls into the same directory as the exe, but other than that it runs perfectly.
As to why it's not working for you, cosmic protector depends on a data directory that holds it's resources. The working directory may be wrong, which would cause it to be unable to find resources. The data dir needs to be copied alongside the executable.
You can set the working directory to $(OutDir) under Debugging in Project->Properties and then it should find any data in the same directory as the exe.
How are you building cosmic protector?
Thanks to BugSquasher, I now have this working.
Here's how...
Start Visual Studio 2017
Create New Project of type Windows Console Application.
Name project CosmicProtector and save it in appropriate place on my HDD.
Disable precompiled headers and delete the any .h and .cpp
files associated with the new project regarding precompiled headers.
(for example pch.h)
Install Allegro 5.2.4 via Nuget.
In Visual Studio, navigate to Project Settings/Properties and ensure all
Allegro addons are enabled.
Copy the Cosmic Protector SRC and Header files and paste them into my
project directory.
Next in Visual Studio Project, Add the Source and Header files
respectively.
Rather stupidly, the step I had missed and that your reply brought my attention to was...
Copy the data directory and paste this into my project directory in the
applicable location.
Now build...
The project built right away, except for some errors reported in Game.cpp, GUI.cpp and Render.cpp
One error in Game.cpp, this being an instance of...
error C4996 'snprintf': This function or variable may be unsafe. Consider using snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
To address this I have changed the instance of snprintf to sprintf_s.
Three errors in GUI.cpp, were instances of...
Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
To address all of these I changed each instance of strcpy to strcpy_s.
And one error in GUI.cpp, this being an instance of...
error C4996 'snprintf': This function or variable may be unsafe. Consider using snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
To address this I have changed the instance of snprintf to sprintf_s.
One error in Render.cpp, this being an instance of...
error C4996 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
To address this I have changed the instance of sprintf to sprintf_s.
Then build and it works:)
Thank you so much for your reply as I had moved on to other things but will find it very useful I think being able to build and run this demo.
It's only your reply that has brought me back to it and this time, I am successful:)

Adding Native support to gstreamer tutorial won't finish

I'm following this:
http://docs.gstreamer.com/display/GstSDK/Installing+for+Android+development
I'm using the Windows x86 ADT bundle, the Windows x86 r9d NDK, and the Gstreamer SDK linked to in the guide.
I was able to get the first tutorial to add native support, build, and run. Then I tried the 3rd tutorial, and Eclipse becomes unresponsive. Same thing happened with the 2nd tutorial. I left it to do it over the weekend in case it just took a long time. When I change anything for another attempt I delete the tutorial folder completely and use a fresh copy from the zip file. I have also remove the ADT bundle completely and started over from scratch.
If I cancel, I have the expected build errors of missing import com.gstreamer.GStreamer;
The GSTREAMER_SDK_ROOT_ANDROID value is set to C:/gstreamer
The NDK Location is C:\android-ndk-r8d
I switched to using r8d as recommended in: Adding Gstreamer support to an android NDK project
One comment also suggests adding to the gstreamer.mk file:
ifndef SYSROOT
SYSROOT := $(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-$(TARGET_ARCH)
endif
I attempted this but there is a gstreamer_prebuilt.mk file it may be using instead.
My only clue is that Tutorial 1 does not use gstreamer plugins and the tutorials that do not work use plugins.
Thank you for any help you can give.
Edit: I tried using android-ndk-r7c also.
Then I deleted the ADT bundle and tried going the "Use an existing IDE" route, same result.
I'm going to try a different machine, and also see if I can compile it without eclipse, but I would love to hear any guess on what's going on.
Edit2: I watched a youtube video of someone setting this up (as far as I can tell he adds the NDK manually adding a build program and pointing to the ndk-build.cmd file):
https://www.youtube.com/watch?v=nKfAELFdf9A
This seemed to work but I was still missing import com.gstreamer.GStreamer; so I closed the tutorial 2 project, built and ran tutorial 1, opened tutorial 2 again, cleaned, built, and it ran.
Problem solved.
I watched a youtube video of someone setting this up (as far as I can tell he adds the NDK manually adding a build program and pointing to the ndk-build.cmd file):
https://www.youtube.com/watch?v=nKfAELFdf9A
This seemed to work but I was still missing import com.gstreamer.GStreamer; so I closed the tutorial 2 project, built and ran tutorial 1, opened tutorial 2 again, cleaned, built, and it ran.
Problem solved.

Linking Qt Libraries to a Cmake project (in eclipse)

so what I'm trying to do is utilize a simple Qt application IN eclipse without using the eclipse QT plugin by linking the required libraries through the GCC C++ Linker. However, I have been unable to locate the exact name of the library to use, or which libraries will be necessary. I've located the path of the Qt library my application seems to be accessing, but I continue to get an error when building that just says "-lqt" doesn't exist/can't find, etc.
The reason I'm doing this is because I'm building a simple game in OGRE for a project at the uni and wanted to use a Qt application for the GUI. Well, I didn't necessarily want too, but our professor wishes us to do so. Please don't suggest that I simply embed an Ogre widgit into my Qt application as this isn't an opti
Any ideas?
Thanks <3
Well, if you are using CMake then it should take care of everything provided that you instructed it to do so. phb provided a link to even better instructions.
First step is to instruct the CMake that we need Qt for our project. This is done with (you can specify individual parts that are needed as well):
find_package(Qt4 REQUIRED)
If Qt is not found in the typical locations (e.g. QTDIR is not set) - cmake will fail.
You also have to instruct CMake to use Qt include paths and set certain compiler definitions:
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
Finally, for each target you need to tell that you'd like to link with Qt libraries:
target_link_libraries(foo ${QT_LIBRARIES})
You might also want to process your headers and will have to process the user interface files with moc. For the details please refer to the provided links.
In addition to provided links you can have a look at the comments at the top of FindQt4.cmake file.

Is is possible to compile projects with "IDE-Managed Components" through the command line?

I've been trying to build some huge projects in BCB5 for some time now. I want to use the command line tools because it would cut build time by more than 50% (it already takes 4 hours in the IDE). Often, projects will build just fine in the IDE but fail miserably in the command line. I did some digging and discovered this nice little comment in a header file:
__published: // IDE-managed Components
Is this saying that the components that follow can only be built with the IDE open? Please tell me there is a way around this. BCB5 is starting to make me depressed.
Extra info:
Make.exe gives a pile of errors claiming ambiguity between the header file and an imported file. I''m pretty sure the header file is supposed to be referencing the imported file though, rather than comparing with it.
In the header file:
#include <ComCtrls.hpp>
ComCtrls.hpp has the variable TTreeNode.
Error from make:
[exec] Error E2015 .\TMain.h 876: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode'
__published: // IDE-managed Components Is this saying that the
components that follow can only be
built with the IDE open? Please tell
me there is a way around this. BCB5 is
starting to make me depressed.
No, this does not mean that you can only build the source in the IDE. It just means that this section is automatically populated by the IDE (the form designer)
While there are good third party solutions (as mentioned by the others) C++Builder 2007 and above made huge improvements in the build system. IDE build times are very similar to command line builds and the MSBuild integration now makes it possible to be sure that the same parameters are passed to the command line tools as are used by the IDE.
Have you tried installing the C++ Compiler Enhancements plugin, by Andreas Hausladen, which improves the compilation speed. I would also recommend installing the DelphiSpeedUp plugin.
I think you need to export the project as makefile, to compile from the command line, because C++Builder 5 project files are XML. Have a look at this article, from the C++Builder Developer's Journal.
If none of the above fails try the official C++Builder Forum.
I've more or less given up on the BCB5 command line tools. It appears that they are fundamentally broken.
I did, however, manage to find a nice open source tool, ProjectMaker, that uses the command line tools effectively. You can find it here: http://projectmaker.jomitech.com.
ProjectMaker fixes up a few of the problems with BPR2MAK, but it's not perfect. Most project build perfectly with ProjectMaker, some still require the IDE. It's not a perfect solution, but it does alright.