I'm getting a compiler error when trying to initialize a geometry shader using OpenGL. I'm using VS2013.
Here is how I initialize it on OpenGL

myCgContext = cgCreateContext();

cgSetParameterSettingMode(myCgContext, CG_DEFERRED_PARAMETER_SETTING);

CGprofile gpProfile = cgGLGetLatestProfile(CG_GL_GEOMETRY);

if (gpProfile == CG_PROFILE_UNKNOWN) {
    if (cgGLIsProfileSupported(CG_PROFILE_GLSLG))
        gpProfile = CG_PROFILE_GLSLG;
    else {
        fprintf(stderr, "%s: geometry profile is not available.\n", gpProfile);

OpenGLRenderer::checkForCgError("selecting geometry profile");

CGprogram prog = cgCreateProgram(myCgContext, 
OpenGLRenderer::checkForCgError("Geometry program");

When I call the function checkForCgError, the compiler throws the following error message: The compiler returned an error. (1) : error C0000: syntax error, unexpected '.', expecting "::" at token '.'

My geometry shader is located in the file "geometry_particles.cg" and the code is

// Geometry pass-through program for colored triangles
void geometry_passthru(AttribArray<float4> position : POSITION, 
                    AttribArray<float4> color   : COLOR)
    for (int i = 0; i < 3; i++) 
        emitVertex(position[i] :POSITION, color[i] : COLOR);

Any thoughts on why the compiler is throwing that error. Am I missing a flag when setting up the shader?

Thanks in advance

Edited 2 Years Ago by uonsin

Someone pointed out that I was using cgCreateProgram instead of cgCreateProgramFromFile, that took care of the error, also I forgot to add the input mode on the post, which I have on the actual file

This question has already been answered. Start a new discussion instead.