2
\$\begingroup\$

I am trying to learn DX10 by following this tutorial. However, my shader won't compile. Below is the detailed error message.

Build started 9/10/2012 10:22:46 PM.
     1>Project "D:\code\dx\Engine\Engine\Engine.vcxproj" on node 2 (Build target(s)).
         C:\Program Files (x86)\Windows Kits\8.0\bin\x86\fxc.exe /nologo /E"main" /Fo "D:\code\dx\Engine\Debug\color.cso" /Od /Zi color.fx 
     1>FXC : error X3501: 'main': entrypoint not found

         compilation failed; no code produced
     1>Done Building Project "D:\code\dx\Engine\Engine\Engine.vcxproj" (Build target(s)) -- FAILED.

Build FAILED.

Time Elapsed 00:00:00.05

I can easily compile the downloaded code, but I want to know how to fix this error myself.

My color.fx looks like this

  ////////////////////////////////////////////////////////////////////////////////
  // Filename: color.fx
  ////////////////////////////////////////////////////////////////////////////////


  /////////////
  // GLOBALS //
  /////////////
  matrix worldMatrix;
  matrix viewMatrix;
  matrix projectionMatrix;


  //////////////
  // TYPEDEFS //
  //////////////
  struct VertexInputType
  {
      float4 position : POSITION;
      float4 color : COLOR;
  };

  struct PixelInputType
  {
      float4 position : SV_POSITION;
      float4 color : COLOR;
  };


  ////////////////////////////////////////////////////////////////////////////////
  // Vertex Shader
  ////////////////////////////////////////////////////////////////////////////////
  PixelInputType ColorVertexShader(VertexInputType input)
  {
      PixelInputType output;


     // Change the position vector to be 4 units for proper matrix calculations.
      input.position.w = 1.0f;

     // Calculate the position of the vertex against the world, view, and projection matrices.
      output.position = mul(input.position, worldMatrix);
      output.position = mul(output.position, viewMatrix);
      output.position = mul(output.position, projectionMatrix);

     // Store the input color for the pixel shader to use.
      output.color = input.color;

     return output;
  }


  ////////////////////////////////////////////////////////////////////////////////
  // Pixel Shader
  ////////////////////////////////////////////////////////////////////////////////
  float4 ColorPixelShader(PixelInputType input) : SV_Target
  {
      return input.color;
  }


  ////////////////////////////////////////////////////////////////////////////////
  // Technique
  ////////////////////////////////////////////////////////////////////////////////
  technique10 ColorTechnique
  {
      pass pass0
      {
          SetVertexShader(CompileShader(vs_4_0, ColorVertexShader()));
          SetPixelShader(CompileShader(ps_4_0, ColorPixelShader()));
          SetGeometryShader(NULL);
      }
  }
\$\endgroup\$

3 Answers 3

9
\$\begingroup\$

VS2012 now includes fxc in it's build process, defaulting it to enabled and a non-fx target.

You can either

Disable it completely as Pasha suggested, by changing the item in the project to Do Not Bulid

or

Change the compile settings to what you want. The easiest way to do this is right click on the .hlsl file, go to properties and then HLSL Compiler. You'll want to remove the entry point, change the type to Effect and whatever shader model you're using (fx_4_0 for d3d10)

\$\endgroup\$
1
2
\$\begingroup\$

Right clicking on the file "color.fx", going to properties and changing the Item Type to "Does not participate in build" made the error go away.

\$\endgroup\$
-1
\$\begingroup\$

May be your problem is Shader Type in settings. Try this http://www.zettabyte.ws/viewtopic.php?f=41&t=1015. For me it was helpful.

\$\endgroup\$
1
  • \$\begingroup\$ -1 Please at least summarize solutions from links in case they get deleted. \$\endgroup\$ Oct 4, 2012 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .