Nvidia SDK compiles

Does anyone got a work-around for this:
GLH_EXT_SINGLE_FILE ??

If that didn’t mean anything to you, then you most-likely dont

The NVidia demos have a build environment that want’s to have headerfiles, and defines included in only one file. If more than one uses them the linker complains and fails. I’ll fix this on my own, but am open to suggestions from others that have gone down the same path.

Jamie

Are you having trouble compiling the SDK or are you having trouble using the glh_extension files in a separate project?

Originally posted by jra101:
Are you having trouble compiling the SDK or are you having trouble using the glh_extension files in a separate project?

I’ve got the SDK to compile, and I incorporated one of the demos features into a component of my game engine. I’m now trying to incorporate another demo into a different component of the game engine, that is in a different file. When I use the same #defines in another file, I get linking errors. What I would like to do is be able to include the glh stuff from more than one file.

I can give you the specific #defines when I get home.

Jamie

[This message has been edited by amendol (edited 04-25-2003).]

Try putting

#pragma once

at top of the header file. You shouldn’t run into the problem of redefine error.

What you need to do is to define GLH_EXT_SINGLE_FILE in a single file, but include glh_extensions.h in all files that use the extension functions.

So for example in one of your .cpp’s you would do this:

#define GLH_EXT_SINGLE_FILE
#include “glh_extensions.h”

then in all your other .cpp files, you would just do this:

#include “glh_extensions.h”

That will fix the linker problems.

Originally posted by shinpaughp:
[b]Try putting

#pragma once

at top of the header file. You shouldn’t run into the problem of redefine error.[/b]

Thanks, still didn’t work though:

cd /home/jamie/game/
make -k
g++ -c -g -Wall -DUNIX -I/home/jamie/SDK/LIBS/inc -I/home/jamie/SDK/DEMOS/OpenGL/inc -I…/…/…/…/inc -I/usr/local/include/glh -I/usr/local/include/moreglh cloudBmpMesh.C
cloudBmpMesh.C:17:9: warning: #pragma once is obsolete
cloudBmpMesh.C:17:9: warning: #pragma once in main file
g++ -c -g -Wall -DUNIX -I/home/jamie/SDK/LIBS/inc -I/home/jamie/SDK/DEMOS/OpenGL/inc -I…/…/…/…/inc -I/usr/local/include/glh -I/usr/local/include/moreglh cloudGF4BmpMesh.C
cloudGF4BmpMesh.C:17:9: warning: #pragma once is obsolete
cloudGF4BmpMesh.C:17:9: warning: #pragma once in main file
g++ -g -Wall glOrbit.cc -o glOrbit -L /usr/X11R6/lib -lGL -lGLU -ltiff -lpthread -lXext -lX11 -lglut -lfreetype -L/home/jamie/SDK/LIBS/lib -lnvparse -lnvpng -L/home/jamie/SDK/DEMOS/OpenGL/src/shared -lnvsdk -lGL -lglut
atmosphere.o
simpleAtmosphere.o
lodAtmosphere.o \

I’m using RH9 – many of the compiles complain about obsolete things now.

Jamie

Originally posted by jra101:
[b]What you need to do is to define GLH_EXT_SINGLE_FILE in a single file, but include glh_extensions.h in all files that use the extension functions.

So for example in one of your .cpp’s you would do this:

#define GLH_EXT_SINGLE_FILE
#include “glh_extensions.h”

then in all your other .cpp files, you would just do this:

#include “glh_extensions.h”

That will fix the linker problems.[/b]

Hmm. Still not solved. Here’s the compile output:


g++ -g -Wall glOrbit.cc -o glOrbit -L /usr/X11R6/lib -lGL -lGLU -ltiff -lpthread -lXext -lX11 -lglut -lfreetype -L/home/jamie/SDK/LIBS/lib -lnvparse -lnvpng -L/home/jamie/SDK/DEMOS/OpenGL/src/shared -lnvsdk -lGL -lglut
atmosphere.o
simpleAtmosphere.o
lodAtmosphere.o
lodGF2Atmosphere.o
textureObject.o
utilities.o
clGlAnimate.o
simpleMesh.o
cloudMesh.o
cloudBmpMesh.o
cloudGF4BmpMesh.o
mesh.o
meshFactory.o
meshCartSphereHash.o
meshSphereSphereHash.o
meshGForce2CartSphereHash.o
meshParse.o
texLoader.o
particals.o
fluid.o
gravity.o
collider.o
collision.o
heightMap.o
physics.o
videoManager.o
cloudGF4BmpMesh.o(.bss+0x4):/usr/include/c++/3.2.2/bits/stl_list.h:138: multiple definition of glh::interactors' cloudBmpMesh.o(.bss+0x4):/usr/include/c++/3.2.2/bits/stl_list.h:138: first defined here cloudGF4BmpMesh.o(.bss+0x8):/usr/include/c++/3.2.2/bits/stl_list.h:261: multiple definition of glh: ropagate’
cloudBmpMesh.o(.bss+0x8):/usr/include/c++/3.2.2/bits/stl_list.h:261: first defined here
cloudGF4BmpMesh.o(.text+0x0): In function glh::glut_display_function()': : multiple definition of glh::glut_display_function()’
cloudBmpMesh.o(.text+0x4956):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:89: first defined here
cloudGF4BmpMesh.o(.text+0x96): In function glh::glut_idle_function()': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:96: multiple definition of glh::glut_idle_function()’
cloudBmpMesh.o(.text+0x49ec):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:96: first defined here
cloudGF4BmpMesh.o(.text+0x130): In function glh::glut_keyboard_function(unsigned char, int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:103: multiple definition of glh::glut_keyboard_function(unsigned char, int, int)’
cloudBmpMesh.o(.text+0x4a86):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:103: first defined here
cloudGF4BmpMesh.o(.text+0x1de): In function glh::glut_menu_status_function(int, int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:110: multiple definition of glh::glut_menu_status_function(int, int, int)’
cloudBmpMesh.o(.text+0x4b34):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:110: first defined here
cloudGF4BmpMesh.o(.text+0x280): In function glh::glut_motion_function(int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:117: multiple definition of glh::glut_motion_function(int, int)’
cloudBmpMesh.o(.text+0x4bd6):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:117: first defined here
cloudGF4BmpMesh.o(.text+0x322): In function glh::glut_mouse_function(int, int, int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:124: multiple definition of glh::glut_mouse_function(int, int, int, int)’
cloudBmpMesh.o(.text+0x4c78):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:124: first defined here
cloudGF4BmpMesh.o(.text+0x3ca): In function glh::glut_passive_motion_function(int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:131: multiple definition of glh::glut_passive_motion_function(int, int)’
cloudBmpMesh.o(.text+0x4d20):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:131: first defined here
cloudGF4BmpMesh.o(.text+0x46c): In function glh::glut_reshape_function(int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:138: multiple definition of glh::glut_reshape_function(int, int)’
cloudBmpMesh.o(.text+0x4dc2):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:138: first defined here
cloudGF4BmpMesh.o(.text+0x50e): In function glh::glut_special_function(int, int, int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:145: multiple definition of glh::glut_special_function(int, int, int)’
cloudBmpMesh.o(.text+0x4e64):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:145: first defined here
cloudGF4BmpMesh.o(.text+0x5b0): In function glh::glut_timer_function(int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:152: multiple definition of glh::glut_timer_function(int)’
cloudBmpMesh.o(.text+0x4f06):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:152: first defined here
cloudGF4BmpMesh.o(.text+0x650): In function glh::glut_visibility_function(int)': /home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:159: multiple definition of glh::glut_visibility_function(int)’
cloudBmpMesh.o(.text+0x4fa6):/home/jamie/SDK/DEMOS/OpenGL/inc/glh/glh_glut.h:159: first defined here
collect2: ld returned 1 exit status
make: *** [glOrbit] Error 1
make: Target `all’ not remade because of errors.

Here’s the head of the complaining files:

cloudBmpMesh.C --------------------------------------------
#include “mesh.H”
#include <GL/gl.h>

#ifndef PS2
#include <GL/glext.h>
#endif

#include “texLoader.H”
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include “utilities/utilities.H”
#include <unistd.h>

#define GLH_EXT_SINGLE_FILE
#include <glh_extensions.h>
#define GLH_NVEB_USING_NVPARSE
#define REQUIRED_EXTENSIONS "GL_ARB_multitexture "
"GL_EXT_secondary_color "
"GL_NV_register_combiners "

#include <glh_nveb.h>
#include <glh_obs.h>
#include <glh_glut.h>

#include <shared/array_texture.h>
#include <shared/data_path.h>
#include <shared/bumpmap_to_normalmap.h>
#include <shared/nv_png.h>
#include <nvparse/nvparse.h>

NVEB_EFFECT_NAME(“Earth Quad”);
NVEB_EFFECT_VERSION(“1.0”);
NVEB_EFFECT_LOCATION(“Effects\Bump Mapping”);
NVEB_EFFECT_ABOUT(0, NULL, “EarthQuad”, “NVEffectsExplained.htm#EarthQuad”);
NVEB_EFFECT_ABOUT(1, “Date”, “May 2001”, NULL);
NVEB_EFFECT_ABOUT(2, NULL, “NVIDIA Developer Relations”, “http://www.nvidia.com/Developer”);
NVEB_EFFECT_EXTENSIONS(REQUIRED_EXTENSIONS);

using namespace glh;

and cloudGF4BmpMesh.C

#include “mesh.H”
#include <GL/gl.h>

#ifndef PS2
#include <GL/glext.h>
#endif

#include “texLoader.H”
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include “utilities/utilities.H”
#include <unistd.h>

#include <glh_extensions.h>
#define GLH_NVEB_USING_NVPARSE
#define REQUIRED_EXTENSIONS "GL_ARB_multitexture "
"GL_EXT_secondary_color "
"GL_NV_register_combiners "

#include <glh_nveb.h>
#include <glh_obs.h>
#include <glh_glut.h>

#include <shared/array_texture.h>
#include <shared/data_path.h>
#include <shared/bumpmap_to_normalmap.h>
#include <shared/nv_png.h>
#include <nvparse/nvparse.h>

NVEB_EFFECT_NAME(“Earth Quad”);
NVEB_EFFECT_VERSION(“1.0”);
NVEB_EFFECT_LOCATION(“Effects\Bump Mapping”);
NVEB_EFFECT_ABOUT(0, NULL, “EarthQuad”, “NVEffectsExplained.htm#EarthQuad”);
NVEB_EFFECT_ABOUT(1, “Date”, “May 2001”, NULL);
NVEB_EFFECT_ABOUT(2, NULL, “NVIDIA Developer Relations”, “http://www.nvidia.com/Developer”);
NVEB_EFFECT_EXTENSIONS(REQUIRED_EXTENSIONS);

using namespace glh;

Jamie

[This message has been edited by amendol (edited 04-26-2003).]

Looks like compile issues with the new version of gcc getting distributed with RH9. I haven’t test the SDK on RH9 yet, only RH8 so far.

I’ll try to find a system on Monday that I can use to install RH9 and resolve these issues.

I just tried it on RH8, I got the same warnings/errors. I’ll look further into it tonight.

Jamie

Can you send me the source to your app thats failing to build? Will be easier for me to locate the problem this way.

Thanks jra101,

No need for me to send you the source. I just got it working.

I followed the suggestions in the NV headers a little closer, and just put the “SINGLE” #define in a seperate cc file.

That didn’t work

I then just started commenting out things until it worked.

This is the offending include:
#include <glh_glut.h>

when this is in two files in this sequence:


#include <glh_extensions.h>
#define GLH_NVEB_USING_NVPARSE
#define REQUIRED_EXTENSIONS "GL_ARB_multitexture "
"GL_EXT_secondary_color "
"GL_NV_register_combiners "

#include <glh_nveb.h>
#include <glh_obs.h>
#include <glh_glut.h>

Then the link errors happen.

Jamie

Glad its working

By the way, you can remove these lines:

#define GLH_NVEB_USING_NVPARSE
#define REQUIRED_EXTENSIONS “…”
#include <glh_nveb.h>

these are only necessary if you are writing a plugin for the Cg Browser in Windows. You don’t need to include them.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.