Code::Blocks to XCode : importing a C++ with a GUI - c++

I currently have a project, written in C++, it uses multiple libraries, including an sqlite and a wxWidgets library, it has a Graphical User Interface, made with Interface Builder.
This project was made with Code::Blocks.
What I now want to do, is import this whole project into XCode to make an .app file. I know about linking and search paths and all that (learned how to do that with a Command Line Project), but other then that, I don't really know where to start. I have searched a lot of forums but it's driving me crazy.
Can anybody help me out with a step-by-step of some sort?
Thanks!

Steps taken
wx-config --cppflags
wx-config --libs
Opening a new xcode project (cocoa)
Pasting the code written (all the classes, and the interface built)
Organizing the header search paths (including the output of libs)
Organizing the linking
Organizing the GCC other flags (including the output of cppflags here)
after that it worked.

Related

Integrating wxWidgets into Existing XCode Project

There are many tutorials about setting up a new XCode project for use with wxWidgets, but I need to integrate it with a large existing XCode C++ project.
The wxWidgets setup process is unclear to me. I built wxWidgets in XCode with the included wxcocoa.xcodeproj file. But when I include all the header files and the libwx_osx_cocoa.dylib library to my existing XCode project, I get all these errors within the wxWidgets header files like Use of undeclared identifier 'wxApp' and No matching constructor for initialization of 'wxEvent' as if it's missing files, but I've included all the header files and compiled library. I tried building wxWidgets in the terminal and get the same errors. I tried make install to actually install wxWidgets on my system. I tried running this command wx-config --cxxflags --libs all in the terminal. I tried adding wx-config --cxxflags and wx-config --libs all to the compiler and linker flags in my XCode project. None of these had any effect.
The irony is that I'm trying to use wxWidgets library to make the GUI process easier, but instead I've spent two days pulling my hair out trying to get my C++ XCode project to compile. Does anyone know what I'm doing wrong?
EDIT: The problem seems to be XCode. I've downloaded the wxWidgets Hello World sample program at the bottom of this page. I can build this program without issue in the terminal, but when I put it into a new XCode project, it won't build. How can I get XCode to build this simple program?
cx-config output:
XCode project settings:
EDIT 2: I exported the Build Log out of XCode and saw that the actual build command uses clang. When I successfully compile Hello World in the terminal, I use clang++. When I try the same command with clang, it doesn't work. Perhaps this is the issue, since clang only links C libraries and the errors XCode is giving me relate to not being able to find standard C++ functions.
EDIT 3: Wow I hate XCode. I got my Hello World program to compile by accident. The solution was putting the wxWidgets compiler flags in the Targets Build Settings, whereas before, I had it in the Project Build Settings. I assumed the Targets would inherit the Project settings, but I guess not!
EDIT 4: I got my complicated XCode project to compile with the wxWidgets libraries by taking all the search paths & flags and moving them from the Project Build Settings to the Targets Build Settings. What a nightmare! Glad it's over
#WaddleDee72
,
I suggest doing following:
Delete wxWidgets directory.
Unpack wxWidgets into i.e. ~/wxWidgets.
Open Terminal.
In the Terminal
4a. cd ~/wxWidgets
4b. mkdir buildOSX
4c. cd buildOSX
4d. ../configure --enable-debug
4e. make -j5
After successful build
wx-config --cxxflags
wx-config --libs
Use the output of 2 commands above and put the values where they belong in XCode project.
If you get any issues - let us know.
Thank you.

Codeblocks required files

I'm learning to use the Codeblocks editor and I would like to setup a SDL2 project. My question is about the necessary files in the SDL2 package.
In the bin directory there is:
sdl-config
In the lib directory there is:
directories -
cmake and pkgconfig
In the share directory there is:
aclocal
I deleted these files, but my experience with SDL2 and C++ is almost at a beginner level. My understanding is, that these support files are for various command line tools used for compilation. For example I know what pkg-config is and I searched somewhat for the other file types. Is it ok to delete these files since I am using Codeblocks, or will Codeblocks possibly require any of these in some unexpected way at a later time? that I might not have considered. As far as I know, Codeblocks makes full use of it's wizards and it's project handling is separate from these other tools. I basically like to set everything up as an Empty Project. I have no compilation issues or errors, but I wanted the opinion of someone more experienced on this.

MinGW "undefined reference to IMG_Load/IMG_Init/IMG_Quit" LazyFoo

I am going off of LazyFoo's SDL2 tutorials for C++ using the MinGW g++ compiler (using console). I have followed his page here, step-for-step. I have finally come across this error after having downloaded his example.
I have seen plenty of people online struggle with SDL_Image, but I've not yet seen this and I haven't found any solution to it yet.
I've loaded the include and lib folders with the proper assets
I've copied all necessary .dll's to my compile destination
The example LazyFoo provides includes for SDL_Image and SDL itself
(this question my sound redundant, but I've yet to come across a solution that applies to console-compilation)
Based on the comments above, the answer seems to be:
You need to install the development libraries for SDL_image.
You can download them here: https://www.libsdl.org/projects/SDL_image/
(look under the heading "Development libraries").
You need to ensure the path where the libSDL2_image.a file resides is in the linker search path. One way of doing this is to add an appropriate -L parameter to the link command. You could also drop the file in the default library search path.
I've had this problem in linux. the solution is simple.
add to linker:
-lSDL2_image -g `sdl2-config --cflags --libs`
I had the same problem, and the solution was to include the SDL2main library in linker parameters.
For Dev-C++ IDE you can follow the instructions below:
Get SDL or SDL2 working correctly with Dev-C++

Eclipse and GTK+ 3.0 development in C/C++ Autocompletion

I am trying for hours now to find what on earth do I have to do in order to make Eclipse show proposals for the GTK+ 3.0 functions in C/C++. Does anyone have any idea how to do this? I mean on Netbeans I didn't do anything at all and it automatically gave me autocomplete suggestions with a little documentation.All I did is to insert the source file and the Makefile. In Eclipse haven't managed to add the Makefile that I made myself but I opened a new project with the source file only. Also I installed pkg-config but there was no luck with it for what I am asking for.
The information is extracted from this blog post:
You need to add the following paths to the "Includes" for the cross G++ compiler:
/usr/include/glib-2.0
/usr/include/gtk-2.0

Netbeans library manager

not sure if this is an appropriate question...
Im using netbeans, and have started to play about with gtk-3.0.
In Netbeans library manager I have added the path /usr/include/gtk-3.0. I have tried to compile a simple project which uses one of the gtk header files. It will not compile, states header file not found. I have checked the class path is correct and that the header file is in the specified location. But had no joy. (the headerfile I am using is gtkmm.h)
I then tried putting the same path into the include directories list in project properties, and the program compiles fine.
My question therefore is, does adding the path in netbeans library manager not automatically include it for my program? I thought this was the whole point? I am stuck with having to add my paths to each new project I create? I thought putting them into the library manager would make this unnecessary? I thought this was the whole point of library manager?
The simplest way is to create a NetBeans "project with existing sources". In order to begin you'll need a directory with only two files - a Makefile and one simple C++ program (with empty main function). However, the Makefile must know about the gtkmm. The pkg-config tool is your friend (in Unix/Linux environment). I have following gtkmm-related lines in my Makefile:
GTKMM_VERSION := gtkmm-3.0
CFLAGS += ${shell pkg-config --cflags ${GTKMM_VERSION}}
LDLIBS += ${shell pkg-config --libs ${GTKMM_VERSION}}
Then you'll need to create a new project in NetBeans - choose "C/C++ Project with existing sources" and tell the NetBeans where your directory is located. The NetBeans will find the Makefile automatically and will try to run it.
A good idea is to run the make in this directory even before creation a new NetBeans project - to make sure the Makefile does what you want.