Thread: Anyone familiar with "premake" ?

  1. #1
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657

    Anyone familiar with "premake" ?

    I'm struggling to resolve a linker error.
    [manasij7479@manasijd Tutorial 0.3.8]$ make config=debug
    ==== Building framework (debug) ====
    ==== Building Tut 16 Gamma Ramp (debug) ====
    Linking Tut 16 Gamma Ramp
    /usr/bin/ld: ../glsdk/freeglut/lib/libfreeglutD.a(freeglut_main.o): undefined reference to symbol 'XPending'
    /usr/bin/ld: note: 'XPending' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
    /usr/lib/libX11.so.6: could not read symbols: Invalid operation
    collect2: ld returned 1 exit status
    make[1]: *** [Tut 16 Gamma RampD] Error 1
    make: *** [Tut 16 Gamma Ramp] Error 2
    The (probable) file in question is:
    Code:
    solution "freeglut"
        configurations {"Debug", "Release"}
        defines {"_CRT_SECURE_NO_WARNINGS", "_SCL_SECURE_NO_WARNINGS"}
    
    dofile("freeglut.lua");    
    
    local dirs = os.matchdirs("progs/demos/*")
    for i, dir in ipairs(dirs) do
        local baseDir = path.getname(dir);
        
        if(baseDir ~= "bin" and baseDir ~= "obj") then
            project(baseDir)
                kind "ConsoleApp"
                language "c"
                includedirs {"include"}
                targetdir(dir)
                objdir(dir .. "/obj")
                files {dir .. "/*.c"};
                
                defines {"FREEGLUT_STATIC", "_LIB", "FREEGLUT_LIB_PRAGMAS=0"}
                links {"freeglut"}
                
                configuration "windows"
                    defines "WIN32"
                    links {"glu32", "opengl32", "gdi32", "winmm", "user32"}
                    
                configuration "linux"
                    links {"GL"}
                    
                configuration "Debug"
                    targetsuffix "D"
                    defines "_DEBUG"
                    flags "Symbols"
    
                configuration "Release"
                    defines "NDEBUG"
                    flags {"OptimizeSpeed", "NoFramePointer", "ExtraWarnings", "NoEditAndContinue"};
        end
    end
    I thought that adding "X11" in line 28 would do it, but got the exact same error.
    The source is here, if anyone of you want to try building it on linux.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    131
    On the surface, it appears you're linking for MS Windows, but XPending is defined in a *nix X11 window library.

    This part:

    Code:
                configuration "linux"
                    links {"GL"}
    is probably causing problems since linux != MS Windows. Try removing those lines or backing up further to see what is adding a linux config to an MS Windows build.

  3. #3
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Cynic View Post
    On the surface, it appears you're linking for MS Windows,
    No I'm not, thanks for replying anyway.

    Btw.... I solved the problem by manually editing (adding the Xlib dependency) the makefiles generated by premake.
    Not a good solution, but would do for now.
    (I'll just write a script to edit the makefile(s) to add -lX11 in the appropriate places.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-31-2009, 04:23 PM
  2. Replies: 46
    Last Post: 08-24-2007, 04:52 PM
  3. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  4. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM