cg setup help

Started by
6 comments, last by extralongpants 13 years, 3 months ago
I decided to delve into some cg shading technologies, where Dev-Cpp is my IDE of choice. But I get errors.

Am I setting up cg resources correctly?

project's parameters for linker:
cgerrorparams.png
Uploaded with ImageShack.us

project's #include dependencies:
cgerrordir.png
Uploaded with ImageShack.us

There are two errors at 'link time':
cgerroractualerrors.png
Uploaded with ImageShack.us

Your prompt assistance would be appreciated.
http://img440.images...gamedevsig.jpg/

I'm not the typical programmer.
Advertisement
The term 'undeclared identifer' refers to some type name, variable name, or #define that the compiler hasn't seen the declaration for. You're either missing a #include, or the identifiers you're referring to don't exist.

Are you including <Cg/cg.h>? If so, what version of Cg do you have installed? According to the documentation, the API you are using was introduced in 2.0. Make sure you're using Cg 2.0 or later.

The term 'undeclared identifer' refers to some type name, variable name, or #define that the compiler hasn't seen the declaration for. You're either missing a #include, or the identifiers you're referring to don't exist.
Are you including <Cg/cg.h>? If so, what version of Cg do you have installed? According to the documentation, the API you are using was introduced in 2.0. Make sure you're using Cg 2.0 or later.


I'm using cg toolkit ver 3.0. I attempted to compile a direct cg example, which is equipped with all the relevant header files.
I just created a project file over such for compilation's sake.

ERRORS ERRORS.

Anybody got a working cg example project set up in Dev-Cpp?
That would help.
http://img440.images...gamedevsig.jpg/

I'm not the typical programmer.
Do you have more than one version installed? In your screenshot, your include directories look wrong - you have .lib file paths where you should just have include folder paths. Also, your lib paths seem strange - usually Cg installs stuff in it's own folder, such that you'd have to add the include path "....../Cg/include" and the lib path "....../Cg/lib".

Make sure you find the folder where cg 3.0 was installed (inspect any version-related files to be certain), and add the appropriate lib and include paths. The "Library Directories" tab should look like:

...
"<path to cg parent folder>/Cg/lib"

and your "Include Directories" tab should look like:

....
"<path to cg parent folder>/Cg/include"
Your advice used:

include dependencies:
include.png
Uploaded with ImageShack.us

lib dependencies:
lib.png
Uploaded with ImageShack.us

params:
params.png
Uploaded with ImageShack.us

literal includes:
includes.png
Uploaded with ImageShack.us

and resulting errors:
errorgg.png
Uploaded with ImageShack.us


Errors.
And i would really like to use platform independent cg.
GLSL did not setup either.

I check many websites. Even checked good site NeHe, and there are no Dev-Cpp conversions for cg shader tutorials. Even fro the horses mouth, setup instructions did not suffice.
http://img440.images...gamedevsig.jpg/

I'm not the typical programmer.
Edit your include path so that the last Cg is excluded - it should just be:
C:\Program Files\NVIDIA Corporation\Cg\include

You'll still have to add the Cg libs to your linker parameters -
C:\Program Files\NVIDIA Corporation\Cg\lib\cg.lib, etc (or just cg.lib, since you have the library path set up).

Also, make sure that you don't have any global Dev C++ settings that have Cg include paths. The fact that you're not getting errors on #include <Cg/cg.h>, even though you don't have your include path set up properly, tells me that Dev C++ must be getting an include path from somewhere else. Look in the Dev C++ settings (not the project settings), and see if you can find any include paths, etc. Get rid of any that are Cg-related.

Working with include paths, and lib paths, and all that stuff for third party libraries can be pretty frustrating at times, but don't give up. Just make sure that when you get it working, you take notes, so you don't have to go through all of this trouble again.
Still no luck. Followed your advice. No luck. Do you happen to have a working example of cg setup in a Dev-Cpp file for eg.?
http://img440.images...gamedevsig.jpg/

I'm not the typical programmer.

Still no luck. Followed your advice. No luck. Do you happen to have a working example of cg setup in a Dev-Cpp file for eg.?


I do not, sorry. To test the suspicion of incorrect include paths, try changing your #includes to refer to the complete path of the files, e.g.:

#include <C:\Program Files\NVIDIA Corporation\Cg\include\Cg\cg.h>

Do this for every Cg-related file that you include. If the compiler still complains about undeclared identifiers, something else must be wrong.

This topic is closed to new replies.

Advertisement