Problem with glaux.h locating - opengl

I try to compile code, that beggins with:
#include<stdlib.h>
#include<GL/gl.h>
#include<glaux.h>
with command:
cc -o test test.c -I/usr/local/include -L/usr/local/lib -lMesaaux -lMesatk -lMesaGL -lXext -lX11 -lm
But one of errors I got is:
test.c:3:18: error: glaux.h: No such file or directory
Then I try:
yum provides glaux.h
but yum find anything.
Before all I installed Mesa with:
yum install mesa*
So, can anyone tell me from where I can get the header file?
Thank you for ahead.

So, I deleted glaux.h from includes (and all functions calls from this header) and successfully compiled with
-lm -lGL
cc keys.

Related

mingw g++ is unable to link with libraries

I'm trying to use X86_64-w64-mingw32-g++ (packaged in Archlinux's MingW package) to cross compile some C++ code into an Windows executable, however I'm having trouble getting past some issues.
I'm calling
x86_64-w64-mingw32-g++ -o build_win/asm build_win/asm.o build_win/asm_lib.o build_win/socket_boost.o -I../extra/etc -fopenmp -lrt -std=c++11 -g -lboost_system -lboost_serialization
from a makefile, but I get thrown the errors:
/usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lrt
/usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lboost_system
/usr/lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lboost_serialization
This works fine with native g++, so exactly do I have to change for mingw to compile?
EDIT: I have mingw-w64-boost package installed, which includes boost libraries pre-compiled and ready to be linked. However, it seems the naming convention is a bit different, and -lboost_system for example becomes -llibboost_system-mt (not exactly sure what the -mt suffix entails).
Problem is I can't find the mingw counterpart for -lrt. I've tried with both -lrtm and -lrtutils but in both cases I get:
[...]
undefined reference to `__imp_getsockopt'
Are you sure that -lboost_system and other libraries are present in the same directory as makefile ?
If not then please include -L flag which indicates the location of your library.
For example:
-L /path_openmp -fopenmp -L /path_boost_system/ -lboost_system -L /path_serialization -lboost_serialization
Moreover, you need not include -I and -g flag when creating an executable from .o files. These are needed when you create .o from .cpp files.
There is no rt library on Windows.
You are missing -lws2_32.
$ x86_64-w64-mingw32-nm -A /usr/x86_64-w64-mingw32/lib/*.a 2>/dev/null | grep getsockopt | grep " T "

fatal error: botan/botan.h: No such file or directory

I've taken the great advice from this answer, checked the file list for libbotan1.10-dev and found /usr/lib/libbotan-1.10.a, so I used the linker flag -lbotan-1.10.
I've successfully been able to code and compile websocket++, json-spirit, connector/c++, and boost::lockfree::spsc_queue.
I'm now trying to use botan's passhash9 to hash passwords.
When I try to compile with
g++ -Ofast -march=native -o btServer broadcast_server_tls.cpp
-I ~/websocketpp-master/ -std=c++0x -D_WEBSOCKETPP_CPP11_STL_
-D_WEBSOCKETPP_NO_CPP11_REGEX_ -lboost_regex -lboost_system
-pthread -L/usr/lib -lssl -lcrypto -ljson_spirit -lmysqlcppconn -lbotan-1.10
g++ gives an error on the #include <botan/botan.h> line, saying "broadcast_server_tls.cpp:12:25: fatal error: botan/botan.h: No such file or directory".
To install on Ubuntu 12.10, I did apt-get install libbotan1.10-dev.
How can I correct this?
You should compile as:
g++ "whatever_source_file" "whatever flags you are already using" -I/usr/include/botan-1.10/

How to link boost libraries properly in Linux

I've been trying to go through Boost tutorials but I got stuck at linking the filesystem library.
I have Ubuntu 12.10. Installation wasn't that hard
sudo apt-get install libboost-all-dev
This put all headers in /usr/local/include and compiled sources in /usr/lib/
[--headers]
[--binaries]
I wrote this program [--program]. When I tried to compiled it
g++ -g tut1.cpp -o tut1 -lboost_system -lboost_filesystem
got this errors: [--errors].
After a little search on http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html
I tried this:
g++ -g -I /usr/local/include/boost/ tut1.cpp -o tut1 -L /usr/lib/libboost_filesystem.a -lboost_system -lboost_filesystem
but didn't have luck. I had the same errors.
Since I cannot put more than 2 links in the post, here are all links
http://pastebin.com/DakVFn12
I found the answer myself here:
http://www.richelbilderbeek.nl/CppLinkErrorUndefinedReferenceToBoostFilesystemDetailGet_current_path_api.htm
Looks like binaries weren't in /usr/lib but in /usr/local/lib.
So the correct command for compilation would be:
g++ -g tut1.cpp -o tut1 -L/usr/local/lib/ -lboost_filesystem
#Yuushi, that was 1 problem.
The -L command should be the base path where the libraries are contained, not the path to a specific library. Try with -L /usr/lib/ instead.

Cannot find boost library

This is a very basic question, I only post because I've spent already some time into it. This is what I've done so far:
Downloaded and compiled the boost library:
sudo ./bootstrap.sh and sudo ./bjam install
This way it was installed into /usr/local/lib.
In my source code I've added only:
#include <boost/asio.hpp>
using boost::asio::ip::tcp
I compile it with:
g++ -I/usr/lib/jvm/java-6-openjdk/include -L/usr/local/lib -fPIC -lboost_system -shared -o libagent.so agent.cpp
However, ldd -d ./libagent.so gives me:
libboost_system.so.1.46.1 => not found
But there is no error thrown, when using the -lboost_system and ls /usr/local/lib gets me among other things:
libboost_system.so
libboost_system.a
What am I missing?
Did the ./bjam install tool also run the ldconfig(8) tool? ldconfig(8) needs to be run after new libraries are installed to update the caches used by ld.so(8) at program execution time.
You should compile it with:
g++ -I/usr/lib/jvm/java-6-openjdk/include -L/usr/local/lib -Wl,-rpath,/usr/local/lib -fPIC -lboost_system -shared -o libagent.so agent.cpp
This makes it look for the boost library in /usr/local/lib at runtime, the -L option only makes it look in /usr/local/lib at compile time.

OpenGL/SDL problem in Ubuntu

I have a C-code which I have not managed to run
http://dl.getdropbox.com/u/175564/problem-sdl.png
The problem is in OpenGL or SDL.
I do not have SDL.h at /usr/local/SDL/SDL.h, so gcc cannot find it.
I have SDL.h installed by MacPorts at /opt/local/include/SDL/SDL.h.
I tried to copy it to /Masi/local/SDL/SDL.h unsuccessfully at the folder by
cp /opt/local/include/SDL/SDL.h /
and by
cp /opt/local/include/SDL/SDL.h /Masi/local/SDL/
I tried to solve the problem by creationg a symlink by
$ln -s /opt/local/include/SDL/SDL.h /Masi/local/SDL/SDL.h
the simplest way to get all the compiler flags for SDL is by using sdl-config:
gcc sdl_gl_1.c $(sdl-config --cflags --libs) -lGL -lGLU
No, Ubuntu does not have them by default (at least the development versions). For my own little program I just installed libsdl1.2-dev and mesa-common-dev (OpenGL).
For the build process I use scons which produces the following commands:
gcc -o src/geom.o -c -Wall -ansi src/geom.c
gcc -o src/main.o -c -Wall -ansi src/main.c
gcc -o test src/main.o src/geom.o -lSDL -lGL
If you install the libraries in some non-standard location, you might have to specify your own include (-I) and library (-L) paths.