Hello I am trying to use msxml and I am getting a linker (VS 2012) error and can't figure out why.
My class file has the following header declaration:
#include <MsXml6.h>
class Foo
{
....
private:
static IXMLDOMDocument* document;
};
I then reference the document with the following (which gives the link error):
CoCreateInstance(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&document);
I have the project setup to link against msxml6.lib. The logs are as follows:
Searching C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64\msxml6.lib:
1> Found IID_IXMLDOMDocument
1> Referenced in Foo.obj
1> Loaded msxml6.lib(msxml6_i.obj)
...
1>Foo.obj : error LNK2001: unresolved external symbol "private: static struct IXMLDOMDocument * Foo::document" (?document#Foo##0PEAUIXMLDOMDocument##EA)
1>Some.exe : fatal error LNK1120: 1 unresolved externals
Is there something important I am missing? Let me know if you need more info.
Thanks!
I found the problem, I forgot to declare the document variable in the source file.
Related
I am porting some C++ code to Android. One of the source files includes a webrtc header file that causes error during compilation. I have reduced the problem to this simple code:
template <class T, int n>
struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>.
static_assert(sizeof(T) == -1, "do not use array with size as type");
};
The error I get is:
[armeabi-v7a] Compile++ thumb: dummyclient <= dummy.cpp
dummy.cpp:7:3: warning: identifier 'static_assert' will become a keyword in C++0x [-Wc++0x-compat]
dummy.cpp:5:8: error: 'DefaultDeleter' is not a template
dummy.cpp:7:17: error: expected identifier before 'sizeof'
dummy.cpp:7:17: error: expected ',' or '...' before 'sizeof'
dummy.cpp:7:70: error: ISO C++ forbids declaration of 'static_assert' with no type [-fpermissive]
The same code compiles fine on Windows and Linux. Is there some compiler settings that are required for Android? Regards.
You need to pass the CPPFLAG -std=c++11.
I am trying to build GPUMLib, and I get the following errors
Error 11 error LNK2019: unresolved external symbol "public: static void __cdecl GPUMLib::Random::SetSeed(unsigned __int64,enum curandRngType)" (?SetSeed#Random#GPUMLib##SAX_KW4curandRngType###Z) referenced in function _main C:\libraries\GPUMLib1\build\src\examples\DBN\DBNapp.obj
Error 12 error LNK2019: unresolved external symbol "public: static void __cdecl GPUMLib::Random::Fill(class GPUMLib::DeviceArray<float> &)" (?Fill#Random#GPUMLib##SAXAAV?$DeviceArray#M#2##Z) referenced in function "public: void __thiscall GPUMLib::RBM::ContrastiveDivergence(int)" (?ContrastiveDivergence#RBM#GPUMLib##QAEXH#Z) C:\libraries\GPUMLib1\build\src\examples\DBN\RBMKernels.lib(RBMKernels_generated_rbm.cu.obj)
Error 13 error LNK1120: 2 unresolved externals C:\libraries\GPUMLib1\build\src\examples\DBN\Debug\DBN.exe 1
Any ideas what might be causing this ? Please note that this is the only part that is unsuccessfully built from the entire library
20> Build all projects
21>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
21>Project not selected to build for this solution configuration
========== Build: 19 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
As the authors of the library suggested, in the src/random folder I had to rename "random.cu" to "random.cpp". This solved the problem.
I am newbie in visual c++.i have created a small program,but its showing error C1083.
My program is like this:
#include <iostream.h>
using namespace std;
void main()
{
cout <<"Welcome to cpp program";
}
the error report is :
1>------ Build started: Project: payroll, Configuration: Debug Win32 ------
1> first_page.cpp
1>c:\users\naga\documents\visual studio 2010\projects\payroll\payroll\first_page.cpp(1):
fatal error C1083:
Cannot open include file: 'iostream.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
i have seen that i should do something with the properties.But i didnt understand that stuff.Also When i click the toolbar and property window,no item appears inside them.I doubt this comes coz i have selected win 32 console application???
std include headers do not need the .h
#include <iostream>
should work.
I have downloaded the source code for a projet in cocos2d-x.
I am using the ./build_native.sh from the Hello World example, which is sure it works.
Yet again I am getting this error when compiling:
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Compile++ thumb : cocos2d <= CCGrabber.cpp
jni/../../libs/cocos2dx/effects/CCGrabber.cpp: In constructor 'cocos2d::CCGrabber::CCGrabber()':
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:46:32: error: 'glGenFramebuffersOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp: In member function 'void cocos2d::CCGrabber::grab(cocos2d::CCTexture2D*)':
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:61:47: error: 'glBindFramebufferOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:65:26: error: 'glFramebufferTexture2DOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:68:63: error: 'glCheckFramebufferStatusOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp: In member function 'void cocos2d::CCGrabber::beforeRender(cocos2d::CCTexture2D*)':
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:88:47: error: 'glBindFramebufferOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp: In member function 'void cocos2d::CCGrabber::afterRender(cocos2d::CCTexture2D*)':
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:113:50: error: 'glBindFramebufferOES' was not declared in this scope
jni/../../libs/cocos2dx/effects/CCGrabber.cpp: In destructor 'virtual cocos2d::CCGrabber::~CCGrabber()':
jni/../../libs/cocos2dx/effects/CCGrabber.cpp:127:35: error: 'glDeleteFramebuffersOES' was not declared in this scope
I searched and found this sollution. But it does not work for me. I am still getting the same error. Maybe it is different in ndk-r8 whilst the sollution is for ndk-r7.
Any help?
Your android sdk version must bigger than 2.2.because from 2.2,the android begin to support opengl es 2.0,and the cocos2d-x 2.0 use the opengles 2.0 to render
I have the following line of code in my program -
typedef GROUP ACE_SOCK_GROUP;
That gives the following warnings and errors -
Warning 181 warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared
Error 182 error C2143: syntax error : missing ';' before 'constant'
Error 183 error C2059: syntax error : 'constant'
The definition of GROUP is given in another file that is included by my program as -
typedef unsigned int GROUP;
What does 'constant' here refer to?
What could be causing the error?
What is the warning indicating
I am using Visual Studio 2008 and found the definition of GROUP using the F12 function
The code is correct.
You're forgetting to include the file where GROUP is defined.
You can try a simple test to confirm this is the issue:
typedef unsigned int GROUP;
typedef GROUP ACE_SOCK_GROUP;
If this compiles, and it will, that means that the previous definition of GROUP is not seen. You need to include the file with the definition before defining ACE_SOCK_GROUP.