Writing a program, using COM ADO library. Everything is working fine, all as it should be. Then low and behold I need to use a function from the ADOX library too. So I add the necessary #import command for ADOX and the compiler generated header throws over a 100 errors.
My import statements are
#import "msado15.dll" rename("EOF", "EndOfFile")
#import "msadox.dll" no_namespace
Note that I lifted those statements straight out of MSDN example, located here https://msdn.microsoft.com/en-us/library/windows/desktop/ms676148%28v=vs.85%29.aspx
Now I discovered that if I add a using command, it sort of works.
#import "msado15.dll" rename("EOF", "EndOfFile")
#import "msadox.dll" no_namespace
using namespace ADODB;
The above will compile and my program works as it should. However, it screws up Visual Studio's contextual visualization. All the type definitions are displaying in black instead of blue and has the red squiggly error indicator underlining it. Mouse over context help says "undefined identifier" even though it will compile fine. And you cant get the type information menu or definition by right clicking on the text.
What is going on here?
Thanks
Related
I am using Visual C++ express 2008 and I want to call GetProcessHandleFromHwnd. I know that I need to include Oleacc which I did by coding
#include <Oleacc.h>
and I also added Oleacc.lib in the Configuration Properties / linker / input / Additional Dependencies. I keep getting the "error C3861: 'GetProcessHandleFromHwnd': identifier not found".
I searched on the net and it seems that I should not need to do anything else...
What I want to do is to get the process for the currently focused application. If there is another simpler way, I am open to suggestions!
I'm working on a Windows forms project in C++ Express 2010. Made some changes to the the Form.h and now get an error when compiling the program. Note the compiler suggests the error is in the main program - open gl test 2 - that #includes the form. All compiled fine for days as I developed the code, then changed something last night and now I get the error.
The main program in open gl test 2 is identical to that of any other forms based project I have created - I've compared to check [except for the obvious changes of namespace etc cause its a different project]
// open gl test 2.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
using namespace opengltest2;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
The error is:
1>open gl test 2.cpp(9): error C2976: 'std::tr1::array' : too few template arguments
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\array(18) : see declaration of 'std::tr1::array'
1>open gl test 2.cpp(9): error C3699: '^' : cannot use this indirection on type 'std::tr1::array'
1> compiler replacing '^' with '*' to continue parsing
line that compiler is complaining about is
int main(array<System::String ^> ^args)
So the fault cant be in where the compiler claims it is - and I can not find a fault in the code in the included files - they compile correctly. I assume the error MUST be in form.h cause that's what I modified that causes this error, but I can not see it. And I'm pretty sure I did not change some project settings.
I ain't including the code for form1.h cause it's toooooo long. Guess what I'm looking for is peoples experience of searching for the error. What strategies can I use to resolve this? If I had hair to pull out I would be surrounded by it. Please help me save my non-existant hair.
It looks like the compiler is getting confused between the managed array type and the array type in the std library. This is probably because somewhere you're doing using namespace std - you should ideally explicitly reference the correct namespace (std::array or cli::array), or remove the include of <array> if it's not needed.
Note that the constant size std::array isn't suitable for use with command-line arguments - you'd need to use a variable size container like cli::array anyway.
I am using VC 6.0 and While compiling the code i am getting this error "error C2995: 'getVector' : template function has already been defined"
I have included the value of WIN32COMMON in the project Settings->C++ tab and in the
category combo box as Preprocessor and in the preprocessordefinition text box as _WIN32COMMON and in the Addition include Libraries text box the complete path as "E:\app\user\product\11.1.0\db_1\OCI\include". in this include folder all the header files are present such as "occi.h".
I also tried with defining WIN32COMMON in my code Explicitly as follows
#include<iostream>
#define WIN32COMMON
#include <occi.h>
using namespace oracle::occi;
using namespace std;
but then it started me giving 102 errors stating that 'DbManager undeclared identifier'.
i had also tried with including the addition libraries in the project settings->link tab->
and in category combobox i selected Input and in the Additional library path i gave the complete path for .lib files as "E:\app\user\product\11.1.0\db_1\OCI\lib\MSVC\vc8" but that also did'nt work. can somebody please guide me.Where iam lacking or i need to define some thing else in my code.
MSVC++ 6.0 doesn't support partial ordering of function templates. Try to replace getVector() with getVectorOfRefs() in your code.
Oracle added getVectorOfRefs() into OCCI to support older Microsoft compilers, such as MSVC6, and recommends to use it in place of getVector().
I just started using QT. Right now I need to transfer some code I have on a Visual C++ project to QT.
The only thing the project does at the moment is open photoshop and set the visible flag to false (it will be used for automation, so a lot of things will be added later).
What I do is, I import 2 photoshop dlls (NOTE: I don’t have .h or .lib for them, just the .dll files)
The method I’m using to import these dlls is through import libid, since all the other methods I tried didn’t work. They are COM objects, btw.
This is my VC++ code:
//library ID of Photoshop.dll
#import "libid:E891EE9A-D0AE-4cb4-8871-F92C0109F18E"
//library ID of PhotoshopTypeLibrary.dll
#import "libid:4B0AB3E1-80F1-11CF-86B4-444553540000"
int main()
{
Photoshop::_ApplicationPtr app( __uuidof(Photoshop::Application));
app->Visible = false;
return 0;
}
Now, QT gives me some warnings and errors on the import lines:
warning: #import is a deprecated GCC extension
error: libid:E891EE9A-D0AE-4cb4-8871-F92C0109F18E: No such file or directory
And then, after that, it says (obviously) that “Photoshop” is not declared.
Now, I searched and the closest solution I found was to include the .tlh files that were created on my VC++ project, but when I did that, I got more than 1 thousand errors and warnings, so that obviously didn’t work.
Can someone please tell me what to do here? I’m seriously stuck!
I want to use Directory.GetFiles to read files from a folder. From msdn website i found:
For c, i have include:
using System;
using System.IO;
For C++, i have include:
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
as header.
For the C++, after the line #using is added, the "fatal error C1190: managed targeted code requires a '/clr' option" appears. So i tried by adding /clr in the visual studio Properties\Linker\Command Line as i found it in other website, but i fail too.
I did it wrongly. So, How to handle error of "fatal error C1190: managed targeted code requires a '/clr' option"? How to "compile with the /clr flag"?
Because i am writing for OpenCv, i have include the following additional dependencies in order to use c and c++:
cv210d.lib
cxcore210d.lib
highgui210d.lib
cvaux210d.lib
Cannot work. What other requirements in order to use Directory.GetFiles?
I also cannot use foreach even i #include .
Is there something similar to use foreach and Directory.GetFiles which is necessary to be included in a project?
I am using Visual Studio 2008
Please help me. Tq
You need to create managed c++ CLI, this should include all the flags for you.
To set /clr from visual studio, go to porject properities->configurations properities->general set common language runtime support to /clr