Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: a opengl es program linking error

  1. #1

    a opengl es program linking error

    hi all:
    i am coding a open gl es program
    i use POWER VR SDK - PC EMULATOR

    the compile is ok
    but link error as below:

    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glDrawArrays@12
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glColorPointer@16
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glVertexPointer@16
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glEnableClientState@4
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glClear@4
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol _glClearColor@16


    i use visual C++6.0, and link libgles_cl.lib.
    could anyone tell me what's going on?

  2. #2
    all egl* function are ok but gl* are linking error....

  3. #3
    Senior Member
    Join Date
    May 2006
    Posts
    353
    I've tested linking and it works just fine using VC++ 6.0. Are you sure you are using the right gl.h header file?

    Your error messages show that the linker is trying to link _gl<...> functions, though it should link __imp__gl<...> instead. This indicates that the functions are not declared as __declspec(dllimport). Usually that should be the case as GL_API should be #define'd as __declspec(dllimport) at the top of GLES/gl.h.


    glClearColor is not part of the OpenGL ES Common Lite profile (libgles_cl.lib). Use glClearColorx if you require Common Lite.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  4. #4
    hi Xmas:

    i use this one :

    C:\Download\OpenGL ES\SDKPackage\Builds\OGLES\Include\GLES\gl.h

    i think it's correct one.

  5. #5
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Yes, that should be the correct header file. Please make sure this is the only (or at least the first) gl.h on your include path. You can easily check by adding a syntax error to it and see whether it still compiles.

    Which version of the PowerVR SDK are you using? Is there a line with
    #define GL_API __declspec(dllimport)
    at the top of gl.h? Does that line get used?
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  6. #6
    1)i don't know the version of the PVR SDK. but i just download it recently.

    2)there are no "#define GL_API __declspec(dllimport) " in gl.h
    3)even i add "#define GL_API __declspec(dllimport) " manually, there are still linking error msg.


    [/code]

  7. #7
    hi Xmas:
    if i add "#define GLAPI __declspec(dllimport)"
    the linking error msg. like bellow:

    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glDrawArrays@12
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glColorPointer@16
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glVertexPointer@16
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glEnableClientState@4
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glClear@4
    OGLESHelloTriangle_Windows.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
    Debug/OGLESHelloTriangle.exe : fatal error LNK1120: 6 unresolved externals

  8. #8
    Senior Member
    Join Date
    May 2006
    Posts
    353
    It seems like your gl.h header file is either leftover from a very old PowerVR SDK install or from a different source altogether. HelloTriangle is a recent addition, but the #define GL_API line has been there for ages. Could you please check the date on that file?
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  9. #9
    hi xmas

    the date of gl.h is 2006/07/20

  10. #10
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Ok, so this seems to be the OpenGL ES 1.0 PC Emulation SDK

    Please try these steps (assuming you unzipped the SDK package to C:\PowerVR, replace as required):
    • Create a new empty Win32 project in VC++ 6.0[/*:m:3me0sm35]
    • Add OGLESHelloTriangle_Windows.cpp to the Source Files[/*:m:3me0sm35]
    • Open the project settings (Alt+F7) and set the following for All configurations:
      [list:3me0sm35]
    • In the Debug tab, category General, set the Working directory to C:\PowerVR\SDKPackage\Builds\OGLES\WindowsPC\Lib[/*:m:3me0sm35]
    • In the C/C++ tab, category Preprocessor,
      [list:3me0sm35]
    • add OGLESLITE to the Preprocessor definitions[/*:m:3me0sm35]
    • add C:\PowerVR\SDKPackage\Builds\OGLES\Include;C:\Powe rVR\SDKPackage\Builds\OGLES\WindowsPC\Include to Additional include directories[/*:m:3me0sm35]
    [/*:m:3me0sm35][*]In the Link tab, category Input,
    • add libgles_cl.lib to Object/library modules[/*:m:3me0sm35]
    • add C:\PowerVR\SDKPackage\Builds\OGLES\WindowsPC\Lib to Additional library path[/*:m:3me0sm35]
    [/*:m:3me0sm35][/list:u:3me0sm35][/*:m:3me0sm35][*]Build and run the project[/*:m:3me0sm35][/list:u:3me0sm35]Following these steps, building and running worked fine for me.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

Page 1 of 2 12 LastLast

Similar Threads

  1. program error
    By jai in forum OpenCL
    Replies: 4
    Last Post: 10-05-2012, 04:00 AM
  2. Program Build Error
    By dlw in forum OpenCL
    Replies: 5
    Last Post: 06-28-2011, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •