#include <iostream>
#include <string>
#include "tinyxml.h"
#include "tinystr.h"
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
bool loadOkay = doc.LoadFile();
if(!loadOkay)
{
printf("\n%s:\n", pFilename);
dump_to_stdout( &doc ); // defined later in the tutorial
}
else
{
printf("Failed to load file \"%s\"\n", pFilename);
}
}
int main(void)
{
dump_to_stdout("example1.xml");
return 0;
}
编译连接出现这样的错误:
error C2664: 'dump_to_stdout' : cannot convert parameter 1 from 'class TiXmlDocument *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
这是为什么啊?这个都是从tinyxml开源上拷下来的!
#include <string>
#include "tinyxml.h"
#include "tinystr.h"
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
bool loadOkay = doc.LoadFile();
if(!loadOkay)
{
printf("\n%s:\n", pFilename);
dump_to_stdout( &doc ); // defined later in the tutorial
}
else
{
printf("Failed to load file \"%s\"\n", pFilename);
}
}
int main(void)
{
dump_to_stdout("example1.xml");
return 0;
}
编译连接出现这样的错误:
error C2664: 'dump_to_stdout' : cannot convert parameter 1 from 'class TiXmlDocument *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
这是为什么啊?这个都是从tinyxml开源上拷下来的!
解决方案 »
- svchost.exe调用DLL执行服务的问题
- 谁有管理图片的图片库吗,要带源代码的
- 对话框引入MSCOMM控件后不能显示的问题,去掉控件后就可以正常显示,有哪位高手QQ帮我看看代码也可以,100分。
- cnzdgs:再帮我解决一下问题
- 调用NetUserAdd失败,提示"_CrtDbgReport: String too long or IO Error"
- 请问哪里能找到介绍如何编写中国象棋算法的资料
- 如何动态的改变对话框的大小?
- 有什么函数可以获得滚动条的宽度?谢谢!
- 昨天编写了一个软件玩玩,大家来下载
- 程序参数设置如何保存,使程序下次运行时能够记住上次的配置,不用重新配置??
- vc 双缓冲区画图
- 被难道了,大家能告诉我原因吗?
// or project specific include files that are used frequently, but
// are changed infrequently
//#if !defined(AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_)
#define AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define DLLEXPORT __declspec(dllexport)
#define DLLIMPORT __declspec(dllimport)#include "stdio.h"
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>#pragma comment(lib,"ws2_32.lib")// TODO: reference additional headers your program requires here
void Msg(char *szFormat, ...);
void dbMsg(char *szFormat, ...);
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_)
不知道是怎么设置预编译器是char * 还是string