Just recently I tried to install GTK+ on Windows 7 using all-in-one bundle and latest MinGW package. I proceeded with all steps of official tutorial. Lurking through several tutorials, especially this one helped me getting MinGW and MSYS set up, so GCC sure works. The command
pkg-config --cflags --libs gtk+-3.0
printed out the expected set of paths/options. However, when I tried to run either
gcc -o gtk3.exe gtk3.c (pasted 'pkg-config' output)
or
gcc -o gtk3.exe gtk3.c `pkg-config --cflags --libs gtk+-3.0`
I've got
gcc: error: gtk3.c: No such file or directory
as a result. Searching the file manually was no success as well. It seems that Windows command prompt has torn the original long command apart, but I don't think that it would be this way if GCC has initialized gtk3.c.
I believe that official tutorial can't be wrong, so please help me resolve this problem.
Best regards, Mathias.
A Windows installation tutorial for GTK+ might not be the most thoroughly tested thing... This is a better version of that page, it includes a link to the source file (although any GTK+ "hello world" code will do).
You could file a bug on the missing link and images as well if you want to help others.
Related
I'm trying to compile a C program using Ncurses on Windows. I compiled it successfully using GCC and it works perfectly if I run it in Cygwin or MSYS2. However, if I try to run it in the Windows Command Prompt, I get this error:
Error opening terminal: xterm-256color.
Is it possible to compile it to run using the native Windows console? This is how I've been compiling it:
gcc -o PROGRAMNAME main.c -lncurses
I also have the Cygwin and Msys dlls for Ncurses copied into the directory of the compiled executable.
Update
So I figured out how to get the program to run. I deleted all the DLLs from the project folder and then added "C:\msys64\usr\bin" to my PATH environment variable. However, I would still like to know if there's a way to get this to work if I were to distribute it, since it's still relying on my installation of MSYS2.
Update 2
Gave up and just used pdcurses and it works fine.
Update 3
Nevermind, found a solution! See below.
I figured out a solution. I'll post it here in case anyone else has this same issue. Thanks to Thomas Dickey for your help!
Install the mingw-w64 toolchain and any other packages you need to compile your project (this is mostly where I messed up)
Make sure to include the /mingw64/include/ncurses directory when compiling, or else gcc won't be able to find curses.h
Include /mingw64/bin as a static directory or copy over the necessary dlls to the same folder as the directory
I ended up with this to compile:
gcc -I/mingw64/include/ncurses -o PROGRAMNAME main.c -lncurses -L/mingw64/bin -static
I am trying to open my in-built camera in order to make a Face Detection program, but I notice that VideoCapture.open(0) does not work when I attempt to run through a cmake compilation, but DOES work when I compile and run through g++.
This program is part of a project, and compiling through CMake is necessary, but nothing seems to work...
(I'm using Ubuntu)
My code compiles and runs, opening the in-built camera (returning "true" on if(capture.isOpened())), when I use
g++ main.cpp FaceDetection.cpp `pkg-config --cflags --libs opencv4`
but returns false on if(capture.isOpened()) and does not open the in-built camera when I compile through cmake.
Any ideas on what I should do for this to run like it runs when I compile it with g++?
Edit: Removed my code, as it wasn't a problem with the code at all. Will answer my own question as I found a solution.
Ran make VERBOSE=1, cmake ../ --log-level=VERBOSE, and
g++ main.cpp FaceDetection.cpp `pkg-config --cflags --libs opencv4`
as Tsyvarev suggested, and found that g++ was including opencv from /usr/include while cmake was including opencv from /usr/local
I found this SOLUTION:
Ran cd /opt/opencv/build && make uninstall first and then ran make in my project folder, which actually solved the problem and opened the camera.
I'm not sure what caused this, but if this happens to anyone, hope this helps!
Following the guide over at http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-2-get-started/get-started/ and I got down to the part where you set up GLFW. Everything was going fine got CMake all installed properly and it went through the process just as shown on the images on the site. Everything installed fine to the /usr/local/include and /usr/local/lib folders. So the next thing to do is test that it installed fine and every time I try to do anything with whats in the glfw folder, gives me this error:
fatal error: 'GLFW/glfw3.h' file not found
These are the commands I've tried to run it with:
gcc boing.c -o boing
gcc -lglfw boing.c -o boing
gcc -lglfw3 boing.c -o boing
gcc -I/usr/local/include boing.c -o boing (different error)
The last one almost worked and gave several different errors, which I think may have been caused by something else. That's kind of besides the point though. What am I doing wrong here? To my knowledge gcc is meant to look in the /usr/local/include folder by default for libraries.
I'm learning SDL through Lazy Foo's tutorial, but I can't proceed further as IMG_Load doesn't seem to work. I tried setting it up like he says, but it just doesn't work. I put all the include files into include folder, and all the lib files into the lib folder. What I found is that there were x86 and x64 folders in the lib folder. When I tried x64 (because I have a 64-bit system)it all worked fine, CodeBlocks even told me suggestions (like when I wrote "img" it showed up a suggestion "IMG_Load" (which means the library got initalized?)), but when I come to compiling my code, this happens: http://puu.sh/3Eqa5.png. When I try with the x86 version, exact same error.
I had a little search around the internet, and all I could find were a few threads, but most of them were abandoned. The closest I got to answering my problem was this: http://www.dreamincode.net/forums/topic/118299-sdl-image-error-sdl/ but the guy solved his problem by downloading a problem which Linux can use, not Windows.
}
I'm running Windows 7 64-bit, CodeBlocks 12.11, SDL 1.2.15 and SDL_Image 1.2.12.
I really don't know what the problem is!
You should go to the Compiler and Debugger settings again and under the Linker Settings tab paste:
-lSDL_image
In addition to the #Aleeee's answer, a command line solution is to add -lSDL2_image compiler flag (SDL2 is the up-to-date version by the time of this writing).
Compilation example:
gcc -o object_file_name source_file_name.c `sdl2-config --cflags --libs` -lSDL2_image
It turns out the SDL_Image library I was using was buggy. I don't know how that happened though. I just had to use a older version. Thanks to anyone who helped!
I'm trying to follow the steps to compile some C code to import into Python from the example given here: http://csl.sublevel3.org/C-functions-from-Python/
I can compile it using the suggested invocation:
gcc -dynamiclib -I/usr/include/python2.3/ -lpython2.3 -o myModule.dylib myModule.c
But I'm using Python 3, I've muddled through and resolved a bunch of compiler errors, to end up with this:
gcc -dynamiclib -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/ -lpython3.2m -o myModule.dylib myModule.c
But now I'm stuck, this gives the following error:
ld: library not found for -lpython3.2m
From my limited knowledge I tried some things out. I've found that I have two locations where Python versions exist:
/System/Library/Frameworks/Python.framework/Versions
and also:
/Library/Frameworks/Python.framework/Versions
Python 3.2 is located in the second place, so I think that somehow I need to tell gcc where to search to resolve the -lpython3.2m? Or that -lpython3.2m is wrong, I've tried -lpython3.2 but I get the same type of error from ld.
Other facts that might help:
Mac OS 10.6.8
Python 3.2 installed from the DMG that you get from Python.org
If there is any other information that I can give you to help you to help me then please let me know
To tell gcc additional directories to search for libraries, you use the -L option, similar to the -I option you're already using. Something like -L/Library/Frameworks/Python.framework/Versions/3.2/lib, I would guess.