Compiling GTK Application under windows using MSYS2 - c++

I'm trying to compile my GTK+ 3 (using gtkmm3) program under windows.
After setting everything up, I now get the following error:
Error: Aggregate »GStatBuf sbuf« has incomplete type and cannot be defined
GStatBuf sbuf;
The same code compiles fine under linux.
Here is the Code that causes the trouble:
GStatBuf sbuf;
if(g_stat(some_c_string, &sbuf) == 0) {
some_var = sbuf.st_mtim.tv_sec;
I'm compiling my program using the following command:
/usr/bin/g++ Patte.cpp -o Patte -L/opt/lib `pkg-config gstreamer-1.0 gstreamer-video-1.0 gtkmm-3.0 --cflags --libs`
I would appreciate any help on this issue :)
Edit: The error occurs pretty deep into the program, so I am pretty sure that nothing that is included is missing.

Related

is there any way that I can add my own custom c/c++ header file to where the standard header functions come from so that I can use them at any time [duplicate]

I am having trouble installing a dependency for a program that itself depends on pcre.h. I have this installed to /opt/local/include, but the C compiler does not see it and thus gives me:
error: pcre.h: No such file or directory
I have confirmed this by writing a hello world program that tries to include it:
#include <pcre.h>
#include <stdio.h>
int main(void)
{
printf("hello, world\n");
return 0;
}
This also gives the error unless I specify the path as </opt/local/include/pcre.h>.
I would like the C compiler to find this by default but I do not know where this is configured. Tab completion hasn't revealed any HEADER_PATH environment variables and I cannot find anything like it that isn't specific to XCode. I am, however, using Mac OSX Snow Leopard on the off chance that makes a difference.
Use -I /opt/local/include on the command line or C_INCLUDE_PATH=/opt/local/include in the environment.
Use the pcre-config utility to get the right flags:
$ pcre-config --libs --cflags
-L/opt/local/lib -lpcre
-I/opt/local/include
If you're compiling via the command line,
$ gcc -Wall -g `pcre-config --libs --cflags` main.c

c++ SDL2 - ld||cannot find -lmingw32|

I was creating program on windows with SDL2 and the program worked fine, but when I changed my os to linux mint (and install code::blocks, gcc, g++, SDL2), I run into troubles with compiling my code.
I have one error:
- ld||cannot find -lmingw32|
I guess that I don't have mingw32 library, where can I get it? Or is the problem diferent?
BTW: I also tryed to google it.
Thank for response.
Read the manual.
On linux you don't need -lmingw32. Instead, use
`sdl2-config --libs`
to get the list of all needed linker flags.
Example usage:
gcc -o myprogram myprogram.o `sdl2-config --libs`
Problem was solved by removing linker on mingw32 and lib rotozoom.h.

c++ compiling error with terminal

I wrote a piece of code with xcode 7.2 on a mac which compiles and works fine. However when i try to compile from terminal with command g++ -std=c++11 -o main.cpp an error occurs undefined symbols for architecture x86_64
functionname(std::_1::basic_istream<char,std::_1::char_traits<char> >&)"
where functionname is a function I created that has a file stream as a parameter.I am new to these kinds of compiling errors, so help would be much appreciated.

error compiling opencv example

I am trying to compile an example that is provided for one of the opencv_contrib modules (text detection module). The link is below:
https://github.com/Balaje/opencv-1/blob/master/samples/cpp/textdetection.cpp
I keep getting errors like: error: ‘ERStat’ was not declared in this scope
I have already compiled and installed opencv_contrib modules and I see text.hpp in /usr/local/include/opencv2. I included text.hpp as well, but I got the same errors. Does anybody know how I can fix the problem?
I compile the file with the following command:
g++ pkg-config --cflags opencv -o textdetection textdetecti
on.cpp pkg-config --libs opencv
Try replacing all ERStat in the code with cv::text::ERStat. It should solve the problem.

error with gtkmm 3 in ubuntu 12.04

i install libgtkmm-3.0-dev in ubuntu 12.04 and i try to learn and write program with c++ and gtkmm 3
i go to this link "http://developer.gnome.org/gtkmm-tutorial/unstable/sec-basics-simple-example.html.en" and try to compile simple example program :
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app =
Gtk::Application::create(argc, argv,
"org.gtkmm.examples.base");
Gtk::ApplicationWindow window;
return app->run(window);
}
my file name is "basic.cc" and i open terminal and type following command to compile:
g++ basic.cc -o basic `pkg-config gtkmm-3.0 --cflags --libs`
compile completed without any error but when i try to run program with type ./basic in terminal i get following error :
~$ ./simple
./simple: symbol lookup error: ./simple: undefined symbol:_ZN3Gtk11Application6createERiRPPcRKN4Glib7ustringEN3Gio16ApplicationFlagsE
~$
how can i solve this problem ?
i can cimpile any gtkmm 2.4 code with this command : " g++ basic.cc -o basic pkg-config gtkmm-3.0 --cflags --libs "
and this command : " g++ basic.cc -o basic pkg-config gtkmm-2.4 --cflags --libs "
thanks
I think you hit this gtkmm bug, apparently triggered by more recent versions of GTK+, and now fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=681323
I have asked Ubuntu to update their package, but they are usually slow about that if they do it at all:
https://bugs.launchpad.net/ubuntu/+source/gtkmm3.0/+bug/1046469
You might want to try reinstalling libgtkmm-3.0-dev. The code compiles fine for me but I get a Seg Fault. It does work when I change Gtk::ApplicationWindow to Gtk::Window.
there is nothing wrong with your install. that code is bad.
try it again, using
Gtk::Window window;
instead of the ApplicationWindow. When the GNOME documentation for a given class has a description of "TODO", that's a bad thing.