error RC2247: Symbol name too long (winnt.h) - windows

I'm getting an RC2247 error (Symbol name too long) when attempting to display the dialogs in a Win32 app. The error is occurring in this file:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\winnt.h
This worked fine under VS2015. The error started when I upgraded to VS2017.
I have seen the following posts, they don't appear to be relevant because they pertain to prsht.h:
RC2247 : Cannot open Rc file : Resource explorer cannot load resource ; Load failed
http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/4a648d6a-ea81-44d3-89c2-57fa5caa6fd6
The error disappears if I comment out the entire resource.rc file. The error occurs if the RC contains the single line:
#include <winnt.h>
When I click on "Edit code"", nothing happens.
I am grateful for any suggestions.

We must not include windows.h or winnt.h to .rc file - this headers - for are for c/c++ compilers and not designed for RC (resource compiler which process .rc file). as result if we include such files we may get errors.
We need include #include <winres.h> to .rc files. this file specially designed for the RC compiler. Internally it included:
#include <winuser.rh>
#include <commctrl.rh>
#include <dde.rh>
#include <winnt.rh>
#include <dlgs.h>
#include <winver.h>
and define some macros.
All standard windows definitions, which we need/use in rc file - exist in winres.h (and it subincludes). From another side in it no extra symbols/definitions wich exist in windows.h - it's not needed for rc and some time can cause errors.
So simply #include <winres.h> at the beginning of resource files and all will be OK.

I have run into this complaint rc2247 when trying to edit the rc file in a project compiled in vs2010. This had been upgraded from vs2050. I found that if I chose to open the .sin file via 'version selector' instead of going straight to vs2010, then it still opens in vs2010 but there is no problem in editing the rc. I don't pretend to understand !
CalendarMan

Related

Recursive include of files in OpenCL source under Xcode

I'm looking to build a host program calling OpenCL code running on my GPU device. The cl source has the following form:
#include "skip_mwc.cl"
typedef struct{ uint x; uint c; } mwc64x_state_t;
//blah...
If I get rid of the #include directive and copy/paste the content of "skip_mwc.cl" directly into this source, I can partially "build" and at least get some errors, showing that my compiler (clang9 cl compiler) can at least recognize the kernels code. With the #include approach I get the following error:
Build log::
<program source>:9:10: fatal error: 'skip_mwc.cl' file not found
#include "skip_mwc.cl"
I have checked and the file is there in the search paths, so I'm inclined to believe that my Xcode IDE doesn't index .cl files properly to perform automatic file inclusion (as in .c or .cpp).
I really want to avoid having to copy/paste source from one file into the other. Any suggestions from someone familiar with Xcode, who has encountered this problem and managed to solve it, are very welcome and needed.
Thanks,
A
Two possible solutions:
Set the -I include_dir compiler option in clBuildProgram(), see also this answer.
Read both files from C++ with fstream and string-concatenate their content.
Also see the option of embedding the OpenCL code into the executable via stringification macro.

Can't use wxWidgets: wxmsw31ud_core.pdb(0,0): Error LNK1136 fatal: invalid or corrupt file

I followed the Creating a new project by hand after building the wx_vc15.sln solution in the ...\wxWidgets\build\msw dir.
I get this error:
...\wxWidgets\lib\vc_x64_lib\wxmsw31ud_core.pdb(0,0): Error LNK1136 fatal: invalid or corrupt file
After rechecking everything (unicode, static linking, Multi-threaded Debug DLL (/MDd), ...), I couldn't find the reason for the error.
These are the preprocessor's definitions I added to the wxWidgets solution, as explained in the Creating a new project by hand page:
WIN32
_LIB
_DEBUG
_CRT_SECURE_NO_DEPRECATE=1
_CRT_NON_CONFORMING_SWPRINTFS=1
_SCL_SECURE_NO_WARNINGS=1
__WXMSW__
WXBUILDING
wxUSE_BASE=0
(The _UNICODE is inherited, no need to add it I presume).

visual studio 2015 c++ sddl.h does not appear as external dependency

I am trying to use the function ConvertSidToStringSid() in a Visual Studio 2015 Community, console project.
According to the msdn page
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376399(v=vs.85).aspx
the requirements are:
Minimum supported client: Windows XP [desktop apps only]
Minimum supported server: Windows Server 2003 [desktop apps only]
Header: sddl.h
Library: Advapi32.lib
DLL: Advapi32.dll
I am using a Windows 10 Home, 64-bit computer. I have the *.lib and *.dll files respectively in :
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64\AdvAPI32.Lib
C:\Windows\System32\advapi32.dll
When i fill in the "#inclucde " in stdafx.h, I get no error from Intellisense. In contrast, "#include <blah.h>" gives a red wiggling underline under the 'include', and a mouse-over says 'Error: Cannot open source file "blah.h"'.
In my .cpp source file, which includes "stdafx.h", I add the code
BOOL OK ... ;
PSID owner;
char *sOwner;
OK = ConvertSidToStringSidW(owner, sOwner);
but then I get the red wiggle under ConvertSidToStringSidW.
In the solution explorer, under the project, under External dependencies there are files SCardErr.h and sdkddkver.h, but nothing, no sddl.h, between these two. (And, by the way, sddkver.h defines _WIN32_WINNT_THRESHOLD 0x0A00. Testing with IntelliSense in the editor, _WIN32_WINNT is also 0x0A00.)
When compiling, I first got an error message that the file sddl.h could not be found. I have multiple copies on the computer, and added to the "Additional include directories" for all configurations, the directory
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared
Compiling still fails with "identifier xxx is undefined" and 'xxx': Identifier not found, from IntelliSense and Build respectively.
The header sddl.h is still not in the external dependencies. Right-clicking on the sdksddkver.h I get its full path: The newly added additional include directory. I don't know what it was before I added this include directory.
Right clicking on the include directive in stdafx.h, I can open sddl.h. The editor shows parts of the contents in a light grey color, when the contents is guarded by an #if/#ifdef directive whose argument is false. However, the function I want to use, ConvertSidToStringSid, is shown in full color.
Unsure if its a clue that the error messages say "defined" rather than "declared". In the project properties, linker, input, additional dependencies, the file advapi32.lib is listed.
What am I doing wrong?
I found the solution myself. The problem was that I had two projects in the same "solution", each with its own stdafx.h file. I had the wrong stdafx.h file open in the editor, and placed the #include directive in the wrong file.
-Thanks

F# Microsoft.ParallelArrays not defined

So I downloaded and installed Microsoft Accelerator v2 to use ParallelArrays. I have referenced it in my project but when I try and execute the code from the module in a script file I get:
"The namespace 'ParallelArrays' is not defined
I have followed the instructions on this post:
Microsoft Accelerator library with Visual Studio F#
I've added a reference to the managed version "Microsoft.Accelerator.dll" to my F# project and then added the native "Accelerator.dll" as an item in my solution and set it's 'Copy To Output Directory' to Copy Always.
Still getting the FSI error and inline error in my script file on the '#load ...' line, however the solution builds fine, and no error in the module file.
Any ideas on what I'm missing? I'm sure it's something stupid.
Thanks,
Justin
UPDATE
I tried mydogisbox's advice, which got rid of the error above, but now when I run the code in the .fsx file I get this error instead:
--> Referenced 'F:\Work\GitHub\qf-sharp\qf-sharp\bin\Debug\Microsoft.Accelerator.dll' (file may be locked by F# Interactive process)
[Loading F:\Work\GitHub\qf-sharp\qf-sharp\MonteCarloGPU.fs]
error FS0192: internal error: F:\Work\GitHub\qf-sharp\qf-sharp\Accelerator.dll: bad cli header, rva 0
UPDATE 2
So the bad header error has dissapeared, but now I get this instead:
Microsoft.ParallelArrays.AcceleratorException: Failure to create a DirectX 9 device.
at Microsoft.ParallelArrays.ParallelArrays.ThrowNativeAcceleratorException()
at Microsoft.ParallelArrays.DX9Target..ctor()
at <StartupCode$FSI_0002>.$FSI_0002_MonteCarloGPU.main#() in F:\Work\GitHub\qf- sharp\qf-sharp\MonteCarloGPU.fs:line 14
Stopped due to error
I found this thread on MSDN however the answers proposed as fixes on that thread barely even relate to the question.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/98600646-0345-4f62-a6c5-f03ac9c77179/ms-accelerator?forum=csharpgeneral
My Direct X version is 11, and I imagine that will suffice, however I tried installing DX9 however, it tells me that a newer version is detected therefore cant install.
There are special directives for referencing dlls from fsi. The #load directive loads the .fs file only. You need to use the #r directive to reference the file. You can either use the full path of the file or you can use #I to include the path to the file. More details here. Keep in mind that fsi is completely independent of your project, so all references in your project must be duplicated in fsi for it to access the same types.

Error 3 error LNK1104: cannot open file 'gtk-3.lib'

I have been trying to get GTK 3.0 to work, and have followed all the steps here
How to configure gtk on Visual studio 2010
And changing to 3.0 where needed to get GTK to work, and it seems to have loaded everything it needs in order to compile, but it gives me the error
Error 3 error LNK1104: cannot open file 'gtk-3.lib'
Whenever I try to run the program.
I am using visual studios 2012, but this was the only place i found anything about getting GTK to run on any visual studios.
Here is the code I am using:
#include <gtk-3.0\gtk\gtk.h>
int main(int argc, char* argv[])
{
gtk_init(&argc, &argv);
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
//gtk_widget_get_preferred_size(window, 300, 200);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_window_set_title(GTK_WINDOW(window), "GTK+ with VS2010");
gtk_widget_show(window);
gtk_main();
return 0;
}
I commented out the gtk_widget_get_prefered_size call because it is irrelevant to the problem
any suggestions? I've looked in several places but none came up with clear answers.
The library gtk-3.lib does not exist. In fact, the library reference is not required to build your GTK 3 application. The pkg-config helper doesn't seem to generate the correct linker flags needed to link your application.
Just add in your Additional Options area all the existing libraries found in your GTK package (\gtk3\lib). The lib files for my bundle (gtk+-bundle_3.6.4-20130921) were as follows:
atk-1.0.lib cairo.lib fontconfig.lib gailutil.lib gdk-win32-3.0.lib gdk_pixbuf-2.0.lib gio-2.0.lib glib-2.0.lib gmodule-2.0.lib gobject-2.0.lib gthread-2.0.lib gtk-win32-3.0.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib
(or you can go to your library path via a command prompt and enter dir *.lib /B)
Don't forget to include the /ENTRY:mainCRTStartup flag mention in the initial answer you started with.
you may have to edit your project settings or use a pragma comment to link with your gtk library:
#pragma comment(lib, "gtk-3")//if the libray is on your project's path
#define PATH "C:\\example\\"
#pragma comment(lib, PATH"gtk-3")//if the library is on PATH

Resources