0
\$\begingroup\$

I am using visual studio c++ 2003 edition and I am trying to use the function CompileFromFIle function from DirectX SDK February 2010 SDK to add bloom to my source code for a mod I am working on and I get this error upon building the release build what is the issue. How do I fix this error?

Output build errors:

c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(839) : error C2061: syntax error : identifier '__out' c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(843) : error C2061: syntax error : identifier '__in' c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : error C2059: syntax error : ')' c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Here is my code cpp file to look at also:

#define _WIN32_WINNT 0x600
#include "stdafx.h"
#include <stdio.h>

#include "C:\Users\john\Desktop\fear public tools 108\Source \Game\ClientFxDLL\D3Dcompiler.h"

#pragma comment(lib,"d3dcompiler.lib")

HRESULT CompileShader( _In_ LPCWSTR srcFile, _In_ LPCSTR entryPoint, _In_   LPCSTR profile, _Outptr_ ID3DBlob** blob )
{
if ( !srcFile || !entryPoint || !profile || !blob )
   return E_INVALIDARG;

*blob = nullptr;

UINT flags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3DCOMPILE_DEBUG;
#endif

const D3D_SHADER_MACRO defines[] = 
{
    "EXAMPLE_DEFINE", "1",
    NULL, NULL
};

ID3DBlob* shaderBlob = nullptr;
ID3DBlob* errorBlob = nullptr;
HRESULT hr = D3DCompileFromFile( srcFile, defines,    D3D_COMPILE_STANDARD_FILE_INCLUDE,
                                 entryPoint, profile,
                                 flags, 0, &shaderBlob, &errorBlob );
if ( FAILED(hr) )
{
    if ( errorBlob )
    {
        OutputDebugStringA( (char*)errorBlob->GetBufferPointer() );
        errorBlob->Release();
    }

    if ( shaderBlob )
       shaderBlob->Release();

    return hr;
}    

*blob = shaderBlob;

return hr;
}

int main()
{
// Compile vertex shader shader
ID3DBlob *vsBlob = nullptr;
 HRESULT hr = CompileShader( L"BloomCombine.hlsl", "VSMain",   "vs_4_0_level_9_1", &vsBlob );
if ( FAILED(hr) )
{
    printf("Failed compiling vertex shader %08X\n", hr );
    return -1;
}

// Compile pixel shader shader
ID3DBlob *psBlob = nullptr;
hr = CompileShader( L"BloomExtract.hlsl", "PSMain", "ps_4_0_level_9_1",    &psBlob );
if ( FAILED(hr) )
{
    vsBlob->Release();
    printf("Failed compiling pixel shader %08X\n", hr );
    return -1;
}

printf("Success\n");

// Clean up
vsBlob->Release();
psBlob->Release();

return 0;
}
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The basic problem here is that VS .NET 2003 support was dropped a long, long time ago. The DirectX SDK (November 2007) was the last release to support VS 2003. The legacy DirectX SDK assumed a specific Windows SDK / Platform SDK and your headers are just too out of date for the February 2010 release (which supported VS 2005 and VS 2008).

The legacy DirectX SDK itself is deprecated. See MSDN.

\$\endgroup\$
5
  • \$\begingroup\$ Well could you retarget the source projects to work on an modern version of visual studio like 2015 I know that the source code projects used a later compiler version to compile the code so I think it would be possible to retarget the binaries and allow the code to work and compile on modern visual studio versions any advice on this to allow the sort of thing. I can then use an earlier version of DirectX to get my shaders to work. \$\endgroup\$
    – hey101
    May 31, 2018 at 15:23
  • \$\begingroup\$ Why do you even need an earlier version of DirectX? Maybe you should post the shaders and the errors you are getting with the modern toolset as a distinct question... \$\endgroup\$ May 31, 2018 at 16:45
  • \$\begingroup\$ That's what I just did its above where the questions is I give you the errors from the output gives you my cpp and even told you what version I was using of visual studio and gave a brief example of what I need help on so what more could you want it seems every f*cking time I post here I get this stupid response just read it and help I mean really its a simple question gosh \$\endgroup\$
    – hey101
    May 31, 2018 at 19:41
  • \$\begingroup\$ Also earlier means a recent DirectX SDK like DirectX 11 if I said a later one then that means I am talking about an out of date SDK like 7.0 etc. come on man read my post carefully. \$\endgroup\$
    – hey101
    May 31, 2018 at 19:43
  • \$\begingroup\$ A key issue with asking for technical advice is that most of the time you the questioner are asking about a specific solution, but you haven't actually defined the problem. The problem here seems to be that you are under the impression that "DirectX SDK" release equates to "DirectX version" which is not correct. See Not So Direct Setup and The Zombie DirectX SDK. TL;DR: Either use the November 2007 DirectX SDK or use modern tools. \$\endgroup\$ May 31, 2018 at 20:20

You must log in to answer this question.

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