未能在lex中包含C ++ librabry

时间:2018-11-17 13:09:45

标签: compiler-construction lex

我试图通过LEX进行一些词法分析,并且我想在定义字段中包含一些c ++库。但是,我尝试了几次,但始终收到此错误消息:

sample.l:2:23: fatal error: iostream: No such file or directory compilation terminated.

这是我的代码的样子:

 %{ #include<iostream> void Print_input(char* yytext){ //function... } %} 

有人知道吗?提前致谢。

1 个答案:

答案 0 :(得分:0)

您正在使用{ "name": "myapp", "description": "myapp", "version": "1.35.0", "private": true, "scripts": { "dev": "nodemon app.js", "debug": "nodemon app.js" }, "dependencies": { "async": "1.3.0", "aws-sdk": "2.7.20", "aws-xray-sdk": "^2.1.0", "aws-xray-sdk-restify": "^1.3.0-beta", "bcrypt": "0.8.5", "body-parser": "1.12.3", "compression": "^1.7.0", "connect-flash": "0.1.1", "cookie-parser": "1.3.4", "cron": "1.0.9", "csurf": "^1.9.0", "csvtojson": "^1.1.2", "date-utils": "1.2.16", "dotenv": "4.0.0", "email-templates": "1.2.1", "express": "4.12.3", "express-handlebars": "2.0.0", "express-jwt": "^5.1.0", "express-mailer": "0.2.4", "express-session": "1.11.1", "express-validator": "3.1.3", "handlebars": "^3.0.3", "helmet": "^3.5.0", "html-pdf": "1.4.0", "json-2-csv": "2.0.12", "jsonwebtoken": "^7.3.0", "multer": "^0.1.8", "mysql": "2.6.2", "newrelic": "1.25.0", "node-schedule": "^1.3.0", "nodemailer": "^1.3.4", "nodemailer-ses-transport": "1.2.0", "passport": "0.2.1", "passport-local": "1.0.0", "path": "0.11.14", "promise": "7.0.0", "qs": "^2.4.1", "replaceall": "0.1.6", "request": "2.55.0", "run-parallel": "1.1.0", "validator": "^7.0.0", "winston": "^2.3.1", "winston-daily-rotate-file": "^1.7.0", "xlsx": "0.8.8" }, "devDependencies": { "nodemon": "^1.17.3" } } 将C ++代码编译为C,而改为使用gcc

请注意,尽管gcc通常使用文件扩展名来确定语言,但是g++即使没有g++选项也会将.c文件编译为C ++。