I'm fairly new to programming in C. For my thesis I have to use the library "Libquantum" from the site http://www.libquantum.de/. I write my code in notepad and compile using the command window. I downloaded mingw and compile with gcc.
For normal C programs everything works fine. I use, for example, the command gcc -o HelloWorld HelloWorld.c and the program compiles fine. But I can't manage to compile programs where I use the library...
I downloaded the library and used the commands ./configure, make, ..., make install like they mentioned in the installation guide (https://github.com/jonbaer/libquantum/blob/master/INSTALL). After the last command the command window showed this:
I made sure to include #include <quantum.h> in the code and tried the linker flag -lquantum on different places when I try to compile but nothing works...
When I try to compile i get the following error
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lquantum
collect2.exe: error: ld returned 1 exit status
As the make install output says you need to tell the linker where the library is using a -L<path> option. The make install places the library in \usr\local\lib. If you are performing the build in MSYS, you can probably use -L\usr\local\lib, but if you have moved the file, change as necessary.
If you are building from cmd.exe (Windows's shell) rather than MSYS, you'll have to use its native a Windows path.
Related
So I have source code written in C for the LibIdn2 library. I am looking to port it into C# but running in to some issues along the way and would appreciate some help.
Installed Cygwin along with Make and GCC G++ packages
Successfully able to run the./configure command on the source directory
After this, running the "make" command produces an .exe file.
I have been trying to get a .dll file created but cannot seem to do so using gcc compiler. The command I am running is:
gcc -shared -o idn2.dll src/idn2.c
but it complains that it cant find the header files referenced in the idn2.c source file.
I have checked that in the idn2.h file, dll_Export is defined.
Any ideas how should I proceed? I need to get a dll.
I have the MinGW install previously working fine with MSYS. They are installed properly and functioning just well.
I installed the PortAudio library and did the install and got the success message after:
./configure
make
make install
When I try to compile samples:
c:\c>gcc patest_mono.c -o pa.exe
patest_mono.c:50:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.
I'm new. I have a feeling I might be doing something fundamentally wrong with the way I'm trying to create the exe from compiling. It's been somewhat of a puzzle quest so far, but I've tried to figure it out and think I am close but completely missing something.
PATH variable ?
In the PortAudio MinGW build instructions I noticed
"The above should create a working version though you might want to
provide '–prefix=<path-to-install-dir>' to configure. "
I've tried adding C:\MingW\PortAudio into the user path. Doesn't work.
I've also tried running the commands in Bash and they come back with an error message "No Rule to make target 'paexpink'" either with the make command, and with gcc .c -o .exe I just get the same error message as compiling straight from the cmd prompt.
I found another source on stack overflow thread with no answers, but the user had commented that http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio provided them a solution but I tried installing the 5 cpython binaries and under the assumption I did it right, it didn't work either.
Thanks for your help,
Julian
To build and install portaudio, you need to add -prefix=/c/<"path to base of the MinGW directory"> to the ./configure line.
For example: ./configure -prefix=/c/MinGW/
then continue the installation by doing
make
After that, do the
make install
and that should install the portaudio files into MinGW.
After it has finished installing, you need to add -lportaudio to the compile command whenever you compile any programs that you want to use PortAudio in.
For example: gcc -o test test.c -lportaudio
I just figured out how to do this today, so I may have accidentally forgotten a few steps.
I am trying to compile this interesting program on my mac. The program can make your terminal looks like the one in Matrix movie. Here is the link.
But when I type "make" and press enter in the upzipped source code folder, here is the error:
make: *** No targets specified and no makefile found. Stop.
I am not very familiar with things that need to compile. I know the concept of compilation and c/c++, but have little practical experience. Is it possible to compile this code on mac? If it is easy, can you tell me how I can compile this code from the above link?
Go to the folder of your source code with terminal and type ./configure and hit enter. Then call make.
The package uses the autoconf tools to generate the Makefile(s) required to build the cmatrix application.
In order to generate the makefiles, you need to run the configure script:
$ ./configure
If you have a look at the INSTALL file, it should provide some additional information, such as additional arguments that you may need to pass into the configure script for your platform.
Once the configure script has run, you can run make as normal, and it should compile the application.
I am trying to run a MPI program with C language.
I have installed GCC compiler and the openmpi libraries. I am running ubuntu Linux and Netbeans IDE. My challenge is that after including ‘mpi.h’ in my header file and compiling the application, I still get ‘fatal error : cannot find file mpi.c’. I have the files in home/user/lib/openmpi/include, but I cant get it too work.
Can anyone help?
You could try to change the compiler to /path/mpicc and the debugger to mpirun. This should work, although I did not test it, but probably the best way to compile MPI code is via terminal.
If you really depend on the IDE you cound try writing your code with it (to take advantage of auto-completion and such) and compile it in terminal using mpicc -o main.exe main.cpp [other .cpp files] and run it with mpirun -np number_of_processes_to_use ./main.exe [args]. You could write a small script or a Makefile to do it all in one command.
Good luck!
to save yourself some sanity, I'd recommend opening up a terminal and going from there (at least until you figure out what's what).
Also, using the mpi compiler to do things would simplify your life. (and likely automatically solve the missing source issue, as it should know where they are by default).
If you still can't locate them during compile then I'd look at adding the location where mpi.c & mpi.h are located to your C Include Path: How to add a default include path for gcc in linux?
I am trying to run someone else's (4 year old) code from sourceforge. I downloaded cygwin and checked out the project with CVS.
Here is the compile line which is failing:
gcc ../block_display/block_display.c -o block_display -lopengl32 -lglut32 -lm
Here is the relevant include statement in block_display.c:
#include <GL/glut.h>
When I try to run the above compile line, I get this compile error:
$ gcc ../block_display/block_display.c -o block_display -lopengl32 -lglut32 -lm
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lglut32
collect2: ld returned 1 exit status
I admit I am new/rusty with cygwin. I tried a few things to get to this point, but since I don't entirely know where to put files, I am stuck on this error. Here is what I have tried:
Downloading all results for 'glut' in cygwin setup: libglut-devel, freeglut, libglut3
Downloading glut 3.7.6, copying glut32.dll to C:\Windows\SysWOW64, and copying glut.h to C:\cygwin\usr\include. I still have glut.def and glut32.lib sitting around, but I do not know exactly where to place them. I tried following this install guide, but since I am not running VC++, I do not know what the cygwin equivalent of VC++ path is.
Any idea what I could do to get this code to compile successfully? I am running Windows 7 64-bit.
You should use freeglut instead. The original glut is far outdated. Freeglut on the other hand is binary and source compatible with the original glut, and it's also open source.
Since glut32.dll is a windows DLL and cygwin is for emulating a unix environment on windows, you can't easily use the original glut with cygwin without recompiling from source.