Thread: Opengl files missing...

  1. #1
    Registered User
    Join Date
    Sep 2008

    Opengl files missing...

    I've decided to try again (after failing miserably last time) to get the files to be able to program OpenGL. When I asked over at the OpenGL forums about the files I needed, this was the response:

    OpenGL32.dll and glu32.dll comes with OS.
    gl.h, glu.h, OpenGL32.lib and glu32.lib comes with your C++ compiler (MSVC or MinGW).
    glut you can get from freeglut project.

    The headers were present with my installation of MinGW but the .lib files were not. glut32.dll was not included with freeglut either.

    So I'm not really sure where to go next really. I can't find where to download the missing .lib and .dll files.

    To make matters worse, when I try to configure freeglut I just get this response:

    $ ./configure
    checking for a BSD-compatible install... /bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for gcc... gcc
    checking for C compiler default output file name... configure: error: C compile r cannot create executables
    See `config.log' for more details.

    Except I know that my compiler CAN produce executables because I use it to program.

    Thanks for any help in advance, I'd really appreciate it =).
    Last edited by Jake.c; 06-12-2009 at 06:00 PM.

  2. #2
    Registered User
    Join Date
    Mar 2007
    If you need glut32.lib and glut32.dll you can download the CUDA SDK from nVidia. It's their SDK for programming their graphics cards, but it has those libraries/dll's floating around in the sample code. Otherwise I could always email you mine (which I got from CUDA).

    EDIT: don't even have to download the whole SDK, you can download one sample (such as image denoising) and get it. Which IDE and OS are you using/on?
    Last edited by scwizzo; 06-12-2009 at 07:14 PM.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Did you run ./configure from cygwin? Do you use cygwin to compile things?

    Also, if you're using MinGW then "opengl32.lib" would be called "libopengl32.a" which would be in your MinGW/lib directory.

  4. #4
    Registered User
    Join Date
    Sep 2008
    I use MSYS. Should I use cygwin instead?

    Thanks for the advice on the file names, I've found all the equivalent files with 'lib' at the start and .a at the end of the file name.

    So I have all the missing files now (I downloaded cuda, thanks!). But I still have this error in MSYS where it tells me my C compiler cannot create executables...

    Thanks for all the help so far.

    EDIT: Does glut have the same syntax and commands as freeglut?

    EDIT: Even when I tried the original glut, I get about 20 errors from the compiler (when compiling the first program in the red book) such as:

    C:/Users/Jake/AppData/Local/Temp/ccY0sAR7.o:pleaseworkog.c:(.text+0x1c): undefined reference to `__glutInitWithExit@12'
    C:/Users/Jake/AppData/Local/Temp/ccY0sAR7.o:pleaseworkog.c:(.text+0x3c): undefined reference to `__glutCreateWindowWithExit@8'
    Last edited by Jake.c; 06-13-2009 at 04:35 AM.

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    I don't care about MSYS vs. cygwin; it was just that whatever you were using was apparently not set up correctly if it couldn't find a compiler.

    You need to link in the glut library when you're compiling, if you're using it.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    Quote Originally Posted by Jake.c View Post
    EDIT: Does glut have the same syntax and commands as freeglut?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Make sure that your C compiler can compile programs from the command-line. I've had a few installations of Dev-C++ which worked fine from the IDE but wouldn't work from the command-line. And the configure script, of course, would be using the command line.

    A few things that might go wrong:
    • The compiler's bin directory might not be in the PATH. You'll get "bad command or file name" or the equivalent when typing "gcc" if this is the case.
    • The compiler may not be able to find its include path. This has happened to me before. Usually the compiler works fine if you run it from its bin directory (as the IDE does), but not when you run it from elsewhere; even if the executable is in the PATH. See below. [1]
    • The compiler may not be able to find the libraries. This might happen if you put libraries in a subdirectory of the compiler's lib directory, for example. You can add -L flags to get the compiler to look in other places for libraries.

    [edit] You should look at the configure log file (is it config.log?). That will tell you the compiler errors that resulted in the script deciding that your compiler can't produce executables. [/edit]

    [1] I solved this somehow, but unfortunately I can't remember how. So I'll just post the simple program I wrote to "fix" this. It can be run anywhere, but executes gcc from its install directory. It changes relative pathnames into absolute ones, so that the paths will be valid from gcc's bin directory.

    Yes, it would probably be easier to figure out which directories gcc can't find and add them to the -I command. Or it would be better yet if I could remember how I ultimately fixed this, but unfortunately I can't. Sorry.
    #include <stdio.h>
    #include <stddef.h>
    #include <stdlib.h>
    #include <string.h>
    #include <limits.h>
    #include <ctype.h>
    #include <unistd.h>
    #define ECHO 0
    struct string_t {
        char *data;
        size_t len, alen;
    void print_usage(const char *progname);
    void append_dir_sep(char **path, size_t *len);
    void append_argument(struct string_t *string, const char *str, size_t slen);
    char *start_path(char *filename);
    int is_file(const char *filename);
    int main(int argc, char *argv[]) {
        char *cwd = getcwd(0, BUFSIZ);
        size_t cwdlen = strlen(cwd);
        char *end;
        int x, is;
        struct string_t command = {0, 0, 0};
        if(argc < 2) {
            return 1;
        append_dir_sep(&cwd, &cwdlen);
        end = start_path(argv[1]);
        if(end != argv[1]) *end++ = 0;
        append_argument(&command, end, strlen(end));
        for(x = 2; x < argc; x ++) {
            is = is_file(argv[x]);
            append_argument(&command, " ", 1);
            if(is) {
                append_argument(&command, cwd, cwdlen);
            append_argument(&command, argv[x], strlen(argv[x]));
        if(end != argv[1]) {
    #if ECHO
            printf("chdir \"%s\" ; ", argv[1]);
    #if ECHO
        return 0;
    void print_usage(const char *progname) {
        fprintf(stderr, "\nexecgcc by DWK"
            "\nExecutable path: %s\n"
            "\nusage: execgcc program [[--file] argN]\n"
            "\nChanges to the directory that program is located in, prepending"
            "the current directory to arguments that are existing files or that"
            " have the --file flag before them.\n", progname);
    void append_dir_sep(char **path, size_t *len) {
        char *p;
        for(p = *path; *p; p ++) {
            if(*p == '\\') *p = '/';
        if(*len && (*path)[*len-1] != '\\' && (*path)[*len-1] != '/') {
            p = realloc(*path, *len + 2);
            if(!p) {
                fprintf(stderr, "Out of memory\n");
            *path = p;
            (*path)[(*len)++] = '/';
            (*path)[*len] = 0;
    void append_argument(struct string_t *string, const char *str, size_t slen) {
        char *p;
        size_t newlen = string->len + slen;
        if(newlen + 1 >= string->alen) {
            if(!string->alen) string->alen = 1;
            while(newlen + 1 >= string->alen) {
                string->alen *= 2;
            p = realloc(string->data, string->alen);
            if(!p) {
                fprintf(stderr, "execgcc: Out of memory\n");
            string->data = p;
        strcpy(string->data + string->len, str);
        string->len += slen;
    char *start_path(char *filename) {
        char *p = strrchr(filename, '\\');
        if(!p) p = filename;
        return p;
    int is_file(const char *filename) {
        if(isalpha(*filename) && filename[1] == ':') return 0;
        return *filename != '-' && *filename != '/' && *filename != '\\';
    I would use this program like this. (Z:\ is the Windows drive from wine.)
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    void grow_command(char **command, size_t *len, size_t need);
    void add_string(const char *str, char **command, size_t *len,
        size_t *used);
    int main(int argc, char *argv[]) {
        char *command = 0;
        size_t len = 0, used = 0;
        int x;
            " Z:/mnt/vista/Dev-Cpp/bin/gcc.exe",
            &command, &len, &used);
        for(x = 1; x < argc; x ++) {
            add_string(" ", &command, &len, &used);
            add_string(argv[x], &command, &len, &used);
        return 0;
    void grow_command(char **command, size_t *len, size_t need) {
        if(*len > need) return;
        if(!*len) *len = 1;
        while(*len <= need) *len *= 2;
        *command = realloc(*command, *len);
    void add_string(const char *str, char **command, size_t *len,
        size_t *used) {
        grow_command(command, len, *used + 1 + strlen(str) + 1);
        *used += sprintf(*command + *used, "%s", str);
    Anyway, I'm not sure how helpful that will be, but it might do something at least. Good luck.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  2. Missing Header files
    By Hexxx in forum C Programming
    Replies: 5
    Last Post: 11-10-2003, 01:21 AM
  3. .TGA files in OpenGL
    By ... in forum Game Programming
    Replies: 2
    Last Post: 10-26-2003, 02:48 PM
  4. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM