当我尝试在flex程序中打印字符串(cout)时,程序崩溃。 我的.l文件看起来像这样:
%{
#include <iostream>
#include <string>
using namespace std;
%}
%option noyywrap
%%
. {string str = "hi"; cout << str;}
%%
int main(){
yylex();
return 0;
}
我使用g ++编译生成的文件。我的flex版本是2.5.35。
当我简单地写cout << "hi";
时,程序不会崩溃。
我做错了什么?
答案 0 :(得分:0)
它似乎适用于flex版本2.5.39。
您可以使用g ++ -E预处理生成的文件并查看输出以查看是否有
的翻译 server <- function(input, output) {
output$plot2 = renderPlot({
database = odbcConnect("database")
start_date = print(input$dates[1])
end_date = print(input$dates[2])
my_query="SELECT
top 30
convert(char(10),datetime,121) as date,
cast(start_destination as varchar(3))
+ (',') + cast(final_destination as varchar(3)) as combo,
count(cast(start_destination as varchar(3))
+ (',') + cast(final_destination as varchar(3))) as volume
FROM
trips
WHERE
datetime >= DATE1 AND
datetime < DATE2
GROUP BY
cast(start_destination as varchar(3))
+ (',') + cast(final_destination as varchar(3)),
convert(char(10),datetime,121);"
my_query <- sub("DATE1",as.Date(start_date),my_query);
my_query <- sub("DATE2",as.Date(end_date),my_query)
sql = sqlQuery(database, paste(my_query))
sql = data.frame(sql, do.call(rbind, str_split(sql$combo, ',')))
colnames(sql)[colnames(sql)=="X1"] <- "From"
colnames(sql)[colnames(sql)=="X2"] <- "To"
sql = sql[,c(4,5,3)]
sql = sql[order(sql$volume, decreasing = T),]
chordDiagram(sql)
circos.clear()
})
}
shinyApp(ui, server)
没有改变。