所以情况就是这样,在我所拥有的依赖结构的build.gradle文件中
dependencies {
compile 'A'
compile 'B'
}
Run Code Online (Sandbox Code Playgroud)
但是,我希望人们能够只编译A或只编译B,有没有办法知道是否通过返回一个可以在其他地方使用的全局布尔值,在gradle任务中使用依赖关系A?
所以换句话说
if (A was compiled) {
compile A;
} else {
exclude A;
}
Run Code Online (Sandbox Code Playgroud) 可能重复:
C++不推荐将字符串常量转换为'char*'
我正在研究C++中的字符串并尝试练习来测试字符串库中定义的一些函数的行为.我昨天编译了同样的程序,一切都没有警告或错误.但是,今天我尝试再次编译程序,但是我收到了以下警告.
D:\C++ CodeBlocks Ex\Strings\main.cpp||In function 'int main()':|
D:\C++ CodeBlocks Ex\Strings\main.cpp|11|warning: deprecated conversion from string constant to 'char*'|
||=== Build finished: 0 errors, 1 warnings ===|
Run Code Online (Sandbox Code Playgroud)
警告引用这条线strncat("Hello",string,STRMAX-strlen(string));.我不确定,但我怀疑是strncat函数不喜欢必须连接文字数组和字符串常量的想法.任何有关这方面的帮助将非常感激.
#include <iostream>
#include <string.h>
using namespace std;
int main(){
#define STRMAX 599
char string[STRMAX+1];
cout<<"Enter name: ";
cin.getline(string,STRMAX);
strncat("Hello",string,STRMAX-strlen(string));
cout<<string;
return 0;
}
Run Code Online (Sandbox Code Playgroud)