为啥总是编译错误??compile error
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为啥总是编译错误??compile error相关的知识,希望对你有一定的参考价值。
哪位牛人帮忙看看是出了什么问题,为什么下面的程序我用自己的VC6.0编译通过了,在北大ACM网上却总说Compile Error
Main.cpp
Main.obj : error LNK2019: unresolved external symbol _strrev referenced in function "int __cdecl searchmaxsubstring(char *)" (?searchmaxsubstring@@YAHPAD@Z)
Main.exe : fatal error LNK1120: 1 unresolved externals
程序如下:
#include <iostream>
#include <string.h>
using namespace std;
int t,n;
char str[100][101];
int searchmaxsubstring(char source[101])
int substrle=strlen(source),sourcestrlen=strlen(source);
int i,j;
bool foundmaxsubstr;
char substr[101],revsubstr[101];
while(substrle>0)
for(i=0;i<=sourcestrlen-substrle;i++)
strncpy(substr,source+i,substrle);
strncpy(revsubstr,source+i,substrle);
substr[substrle]=revsubstr[substrle]='\0';
strrev(revsubstr);
foundmaxsubstr=true;
for(j=0;j<n;j++)
if(strstr(str[j],substr)==NULL&&strstr(str[j],revsubstr)==NULL)
foundmaxsubstr=false;
break;
if(foundmaxsubstr)
return(substrle);
substrle--;
return 0;
int main()
int searchmaxsubstring(char source[101]);
int i,minstrlen=0,substrlen=0;
char minstr[101];
cin>>t;
while(t--)
cin>>n;
minstrlen=100;
for(i=0;i<n;i++)
cin>>str[i];
if(strlen(str[i])<minstrlen)
strcpy(minstr,str[i]);
minstrlen=strlen(minstr);
substrlen=searchmaxsubstring(minstr);
cout<<substrlen<<endl;
return 0;
非常感谢深绿青蓝,但是把main()里面的声明函数去掉还是不行哦...到底是为什么呢...
自己写一个看看
ERROR 错误:Angular JIT 编译失败:'@angular/compiler' 未加载
【中文标题】ERROR 错误:Angular JIT 编译失败:\'@angular/compiler\' 未加载【英文标题】:ERROR Error: Angular JIT compilation failed: '@angular/compiler' not loadedERROR 错误:Angular JIT 编译失败:'@angular/compiler' 未加载 【发布时间】:2021-05-25 09:15:07 【问题描述】:我在使用 VSCode 在开发环境中运行我的应用程序时突然遇到的错误,
main.js:7740 ERROR Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
- JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
- Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
- Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
at getCompilerFacade (vendor.js:20189)
at Function.get (vendor.js:33871)
at getInjectableDef (vendor.js:19941)
at resolveNgModuleDep (vendor.js:47812)
at NgModuleRef_.get (vendor.js:48688)
at resolveDep (vendor.js:49213)
at createClass (vendor.js:49071)
at createDirectiveInstance (vendor.js:48882)
at createViewNodes (vendor.js:60498)
at callViewAction (vendor.js:60948)
还有一个错误提示
Angular 扩展可能无法正常工作,因为 ngcc 操作失败。尝试通过运行“npm/yarn run ngcc”手动调用 ngcc。有关更多信息,请参阅扩展输出。
Package.json 包含以下内容
"name": "dxfsuite",
"version": "0.0.0",
"scripts":
"ng": "ng",
"start": "ng serve -o --proxy-config proxy.conf.json --port 4200",
"build": "ng build",
"build-prod": "ng build --prod --stats-json --source-map=false",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
,
"private": true,
"dependencies":
"@angular-devkit/schematics-cli": "^0.901.14",
"@angular/animations": "~9.0.0",
"@angular/cdk": "^9.1.0",
"@angular/common": "~9.0.0",
"@angular/compiler": "~9.0.0",
"@angular/core": "~9.0.0",
"@angular/forms": "~9.0.0",
"@angular/localize": "^9.1.13",
"@angular/platform-browser": "~9.0.0",
"@angular/platform-browser-dynamic": "~9.0.0",
"@angular/router": "~9.0.0",
"@elastic/apm-rum-angular": "^0.5.0",
"@fullcalendar/angular": "^4.4.5-beta",
"@fullcalendar/core": "^4.4.0",
"@fullcalendar/daygrid": "^4.4.0",
"@fullcalendar/timegrid": "^4.4.0",
"@ionic/angular": "^5.5.4",
"@ng-bootstrap/ng-bootstrap": "^6.0.0",
"@ng-select/ng-select": "^3.7.2",
"@swimlane/ngx-charts": "^13.0.2",
"@types/jquery": "^3.5.5",
"angular-feather": "^6.1.0",
"apexcharts": "^3.25.0",
"bootstrap": "^4.6.0",
"bootstrap-daterangepicker": "^3.0.5",
"bootstrap-tagsinput": "^0.7.1",
"daterangepicker": "^3.0.5",
"install-peers": "^1.0.3",
"jquery": "^3.4.1",
"jqueryui": "^1.11.1",
"loadash": "^1.0.0",
"lodash": "^4.17.15",
"moment": "^2.26.0",
"moment-timezone": "^0.5.33",
"ng-apexcharts": "^1.5.8",
"ng-zorro-antd": "^9.0.0-beta.0",
"ng2-daterangepicker": "^2.0.12",
"ngx-filesize": "^2.0.13",
"ngx-perfect-scrollbar": "^8.0.0",
"ngx-sortablejs": "^3.1.4",
"ngx-spinner": "^10.0.1",
"peity": "^3.3.0",
"popper.js": "^1.16.1",
"ramda": "^0.26.1",
"rxjs": "^6.5.4",
"service-worker": "0.0.0",
"sortablejs": "^1.13.0",
"tslib": "^1.10.0",
"videogular2": "^7.0.2",
"vivus": "^0.4.5",
"web-push": "^3.4.3",
"zone.js": "~0.10.2"
,
"devDependencies":
"@angular-devkit/build-angular": "~0.900.1",
"@angular/cli": "~9.0.1",
"@angular/compiler-cli": "~9.0.0",
"@angular/language-service": "~9.0.0",
"@ionic/angular-toolkit": "^3.1.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.20.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.7.5"
及其config.json
"compileOnSave": false,
"compilerOptions":
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
,
"angularCompilerOptions":
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
搜索了许多论坛以解决此问题。但对我没有任何帮助。
请帮忙
【问题讨论】:
有些人推荐了this(即禁用Ivy并重新安装node_modules
),但它对我有用而没有禁用Ivy。我不得不恢复我的package.json
,因为它不知何故被更改了,然后删除了node_modules
,然后运行npm i
来恢复模块。
【参考方案1】:
对我来说是由 Angular 语言服务扩展引起的。
-
在扩展设置中启用旧版视图引擎
删除node_modules文件夹(
npx rimraf node_modules
)
运行npm install
编辑:应该在this commit 中修复。
【讨论】:
以上是关于为啥总是编译错误??compile error的主要内容,如果未能解决你的问题,请参考以下文章
Quartus 11进行编译Compile Design的时候出现错误near text ã
Error:java:错误:不支持发行版本 5 (默认1.5编译)Information:java: Errors occurred while compiling module ‘java_web_
RVCT编译错误 Cannot obtain license for Compiler
错误记录编译 ijkplayer 报错 (fatal error: ijksoundtouch/ijksoundtouch_wrap.h: No such file or directory )