我正在使用gnuplot在C++中绘制图形.该图正如预期的那样绘制,但在编译期间会出现警告.警告意味着什么?
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的功能:
void plotgraph(double xvals[],double yvals[], int NUM_POINTS)
{
char * commandsForGnuplot[] = {"set title \"Probability Graph\"",
"plot 'data.temp' with lines"};
FILE * temp = fopen("data.temp", "w");
FILE * gnuplotPipe = popen ("gnuplot -persistent ", "w");
int i;
for (i=0; i < NUM_POINTS; i++)
{
fprintf(temp, "%lf %lf \n", xvals[i], yvals[i]);
//Write the data to a te mporary file
}
for (i=0; i < NUM_COMMANDS; i++)
{
fprintf(gnuplotPipe, "%s \n", commandsForGnuplot[i]); …Run Code Online (Sandbox Code Playgroud) 无法在ubuntu中编译C++程序.
float x;
x=(m*Ts1)-(n*Ts);
new_samples[m]=(original_samples[n*Ts]*(sin(x))(2*pi*B))/(2*pi*B*(x));
Run Code Online (Sandbox Code Playgroud)
我想sin在C++中使用函数.我已经包括cmath.仍然是错误:
错误:'std :: sin(x)'不能用作函数.