Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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);
      }
  }
share|improve this question

3 Answers 3

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)

share|improve this answer
    
blogs.msdn.com/b/chuckw/archive/2012/05/07/… - be certain to check the second para under the "Visual Studio 2012 and HLSL" if you're going to take the second option. –  Jimmy Shelter Sep 18 '12 at 23:37

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.

share|improve this answer

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.

share|improve this answer
    
-1 Please at least summarize solutions from links in case they get deleted. –  Markus von Broady Oct 4 '12 at 21:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.