生成DLL时发生C ++错误:const wchar_t *类型的参数与LPWSTR类型的参数不兼容

问题描述

我是C ++编程的新手。

我需要使用教程中提供的头文件解决方文件来创建DLL。我遵循了here中的基本步骤,但是,解决方文件中出现以下错误

L111 !CreateProcess(L".\\phreeqc\\phreeqc.exe",

L112 TEXT(".\\phreeqc\\phreeqc.exe .\\phreeqc\\phreeqc_input.txt .\\phreeqc\\phreeqc_input.out .\\phreeqc\\wateq4f_plus.dat")

错误

L111

C2664'BOOL CreateProcessW(LPCWSTR,LPWSTR,LPSecurity_ATTRIBUTES,LPSecurity_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCWSTR,LPSTARTUPINFLOW,LPPROCESS_informatION)':无法将参数2从'const wchar_t [105]'转换为'LPWSTR'

L112

E0167类型为“ const wchar_t *”的参数与参数不兼容 类型为“ LPWSTR”。

我了解以上代码行中的细节对你们中的许多人没有多大意义,但我希望有人至少能够理解C ++错误并在此提供帮助。

解决方法

public class MyItemProcessor implements ItemProcessor<MyItem,MyItem> { private ExecutionContext executionContext; public MyItemProcessor() { this.executionContext = jobExecution.getExecutionContext(); } @Override public MyItem process(MyItem item) throws Exception { // get the line from previous item processors,if exists,otherwise start with 0 int line = executionContext.getInt("myLineKey",0); item.setLine(line++); // save the line for other item processors item.put("myLineKey",line); return item; } } 的Unicode版本(这是一个映射到{ "rules": { ".read": ... ".write": ... "busStops": { ".indexOn": "busStopName" } } } 的宏)要求library(dplyr) library(ggplot2) df %>% mutate(year = lubridate::year(Date)) %>% ggplot() + aes(x = year,y=Sales,fill = Holidays) + geom_col(position = 'dodge') 参数使用可写的字符串,字符串文字为CreateProcess。因此,您不能直接为该参数传递字符串文字。

相反,您可以这样更改代码:

CreateProcessW

文档here