I am working on Win32 project in Visual studio 2012. It has file selection button using MFC Editbrowse Control. To write a code for this control, I have added afxeditbrowsectrl.h header file. When I build the solution, it gives me following error:
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\vc\atlmfc\include\afxeditbrowsectrl.h(67): error C2065: 'BIF_RETURNONLYFSDIRS' : undeclared identifier
My question is why this error occurs and how should I remove this error. Kindly guide me.
Never add only those internal MFC header files. Always include afx.h or afxwin.h. Or if you do this. always make sure that you included afx.h or afxwin.h first.
Otherwise you get Errors like this.
Edit: And never include Windows.h before any MFC include. This will cause additional errors. If you use the MFC just include afx.h or afxwin.h first. Windows.h is included by the MFC include files.
Related
The project was created using Visual C++ 6.0 and I'm new to using Visual C++. Now in my project, I set up Visual C++ on Windows 10, but when rebuild all below error C2259 throw. Please help me how to fix this error C2259. Thanks in advance.
D:\VS98\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject' : cannot instantiate abstract class due to following members:
D:\VS98\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject >::CreateInstance(void *,const struct _GUID &,void ** )'
At last, found the issue. One of the method definitions is different.
To resolve,
Check the function declarations and definitions prototypes in the .cpp,.h and .idl files. Also, check if they are same in all the 3 files.
.idl file we usually miss out on modifying since the search result doesn't show the method.
I'm trying to write an x2 camera driver for a Hamamatsu camera in Visual Studio 2015. The X2 driver template already has windows.h included as an external dependency, but when trying to include a necessary header file, it throws an error that windows.h is not included (along with 80 or so errors of function calls that therefore don't exist). But when I include windows.h, I think it's causing a double include and is throwing this error:
Severity: Error (active)
Code: none
Description: expected an identifier Project :x2camera
File: c:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\winnt.h
Line: 524
I'm really new to working with Visual Studio projects - how can I include windows.h into the file so it can get the functions and declarations it needs without actually including it and causing a double inclusion? Like I said, it's in the "project dependencies" list, and I think it's being included in another file (but I'm having a hard time finding that).
Or is that not even my problem?
Any help is appreciated.
No idea what the problem was but I somehow managed to get it to compile. I think it needed to be included elsewhere first, then built, then included where it needed to be... which doesn't make sense honestly but maybe it was an error with how the inclusion was functioning.
Either way, my question is now resolved, though the questions that now arise such as "why the heck did this work" are baffling.
I have a fairly simple, multithreaded application that runs as a console app in c++, based mostly on calling external dlls. I need to add a Form to it, so I have created a new visual studio project (c++/CLR), and am adding my existing cpp and .h files to it. BUT, when I try to build, i get:
Severity Code Description Project File Line Suppression State
Error C1189 #error: <thread> is not supported when compiling with /clr or /clr:pure.
Severity Code Description Project File Line Suppression State
Error (active) #error directive: <mutex> is not supported when compiling with /clr or /clr:pure.
IS this how I should be adding a form? How can I get around this error?
Thanks.
Ah, solved. As here:
VC2008, how to turn CLR flag off for individual files in C++/CLI project
I need to turn off clr support on the single .cpp file.
I've been using Typescript 0.9.5 for the last few days, and then suddenly today the JavaScript files just stopped being generated. I see an error "Output generation failed" in the Visual Studio status bar, but nothing in any of the output windows.
I've rebooted, and restarted Visual Studio, disabled Web Essentials, tried all the usual things.
The files are set as TypescriptCompile in the properties. I've tried adding new files, or editing old ones with no effect. The Project file hasn't been changed as far as I can tell (its in TFS and none of the TypeScript sections have been altered).
I've made sure both files are checked out, still nothing.
Update: I've managed to compile manually using tsc.exe from the command line, so it must be something in Visual Studio.
OK, so I solved the problem.
One of my files contained invalid typescript, specifically trying to export a class when not inside a module. This caused all typescript files to fail to generate, but with no useful error message.
The following file would cause the problem:
export class Test {
public DoSomething() {
}
}
Either removing the export keyword, or adding a wrapping module solved the problem.
I've raised it as an issue here: https://typescript.codeplex.com/workitem/2109
Update: More details.
The above syntax is valid if you are using the CommonJS or AMD module patterns.
To enable this in visual studio you need to edit the .csproj file and insert a new PropertyGroup:
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
If you have an export outside of an internal module Typescript tries to compile it as either commonjs or amd module format. The compilation will fail if the a --module flag is not present on the command line. Use your project properties to set it to the desired value (probably amd in your case).
More info on TypeScript modules : http://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1
By default, Visual Studio compiles a project to use the Multi Threaded DLL, found in the Visual Studio runtime. I want to compile my program using only /MT instead of /MD. Granted, that most systems already have this installed, and it's also available as a re-distributable.
When I change /MD to /MT, I get an error:
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
And four or five similar errors.
To try and fix this I removed LIBCMT.LIB from the default libraries.
I then get the error:
libcpmt.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_crt referenced in function __Getctype
Removing MSVCRTD.lib from the default list leads to similar errors?
It should be noted that:
-This is an OpenGL project, using the glfw library.
-I am using the SOIL image library by lonesock for texture loading.
Without any further precise information, I would say your first problem is that you're somehow mixing release and debug versions of libraries. MSVCRTD.lib is the debug version of MSVCRT.lib.
Either you have some debug settings hanging around in your own projects, or you're linking against debug versions of libraries you're using.
Never ever mix debug and release versions. If you're lucky you get an error like this. In some rare situations all magically seems to work until it doesn't.