无法解析函数'strlen' - Eclipse cpp
Function 'strlen' could not be resolved - Eclipse cpp
我是 eppp 的 Ecplipse 新手,我遇到了很多问题。
修复:1)一开始没有包含文件夹。
解开了 Eclipse 的 zip,但它没有自由(或包括),所以我使用包含文件夹的 DEV(安装了 MinGW 并包括它们的)设置了"路径和符号"。这样做,我解决了包含的问题。
未修复:2)"无法解析函数'strlen'"
未修复 3)"程序"g++"(gcc也是)在PATH中找不到"
我用以下垃圾箱设置了路径:dev,mingw和mingw/msys文件夹...但没有工作
#include <iostream>
#include <stdlib.h>
#include "D:Documentifunz.cpp"
#include "D:Documentiwinfunz.cpp"
using namespace std;
typedef char Elem;
struct Node{
int id;
Elem * val;
Node* prev;
Node* next;
};
typedef Node* List;
class Fifo{
List l;
public:
Fifo(){
l=NULL[enter image description here][1];
}
void insert(List &l, Elem *val, int id){
Node *n;
int riemp=strlen(val);
n=new Node;
n->val=new char[riemp+1];
n->id=id;
strcpy(n->val, val); // equivale a (*n).val=val;
n->next=NULL;//a prescindere è NULL
if (l==NULL){//se è il primo elemento
n->prev=NULL;
l=n;
}
else
if (l->next==NULL){//se è il secondo elemento
l->next=n;
l->prev=n;
n->prev=l->prev;
}
else {
(l->prev)->next=n;
n->prev=l->prev;
l->prev=n;
}
}
Node* search(List l, int id){
while (l!=NULL && l->id!=id)
l=l->next;
return l;
}
void delete_node(List & l, Node* n){
short int deltype=0;
if (n->next==NULL && n->prev!=l) deltype=1;//se è l'ultimo elemento
if (n->next==NULL && n->prev==l) deltype=2;//se è il secondo elemento
if (n->next==NULL && n==l) deltype=3;//se l'unico elemento
if (n->next!=NULL && n==l) deltype=4;//se solo il primo elemento vine eliminato
switch (deltype){
case 1:
l->prev=n->prev;
(n->prev)->next=NULL;
break;
case 2:
l->prev=NULL;
l->next=NULL;
break;
case 3:
l=NULL;
break;
case 4:
if (l->prev==l->next)//se sono solo gli ultimi due e il boss viene eliminato
(l->next)->prev=NULL;
else
(l->next)->prev=l->prev;
l=l->next;
break;
default://se è un elemento non primo e non ultimo && la lista ha elementi>2
(n->prev)->next=n->next;
(n->next)->prev=n->prev;
}
delete[] n->val;
delete n;
}
void print(List l){
if (l==NULL) cout<<"nLista vuotan";
int tmp;
char num[3+1] ;
while (l!=NULL){
tmp=l->id;
if(tmp<10) strcpy(num, strcat("00", MioNS::conv_num_numchar(tmp)));
else if(tmp<100) strcpy(num, strcat("0", MioNS::conv_num_numchar(tmp)));
else strcpy(num, MioNS::conv_num_numchar(tmp));
cout<<num<<":"<<l->val<<endl;
l=l->next;
}
cout<<'n';
}
void init_list(List & l){
l=NULL;
}
void delete_list(List & l){
Node* n;
while (l!=NULL){
n=l;
l=l->next;
delete[] n->val;
delete n;
} }
void printfile(List l , ofstream& out){
int tmp;
char num[3+1] ;
while (l!=NULL){
tmp=l->id;
if(tmp<10) strcpy(num, strcat("00", MioNS::conv_num_numchar(tmp)));
else if(tmp<100) strcpy(num, strcat("0", MioNS::conv_num_numchar(tmp)));
else strcpy(num, MioNS::conv_num_numchar(tmp));
out<<num<<":"<<l->val<<endl;
l=l->next;
}
out<<'n';
}};
希望代码不是问题。
错误
Description Resource Path Location Type
Cannot run program "sh" (in directory "E:CPPworkspaceProva1"): CreateProcess error=2, Impossibile trovare il file specificato Prova1 -1 Configure Problem
Function 'strcat' could not be resolved Prova1.cpp /Prova1/src line 102 Semantic Error
Function 'strcat' could not be resolved Prova1.cpp /Prova1/src line 103 Semantic Error
Function 'strcat' could not be resolved Prova1.cpp /Prova1/src line 128 Semantic Error
Function 'strcat' could not be resolved Prova1.cpp /Prova1/src line 129 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 31 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 102 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 103 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 104 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 128 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 129 Semantic Error
Function 'strcpy' could not be resolved Prova1.cpp /Prova1/src line 130 Semantic Error
Function 'strlen' could not be resolved Prova1.cpp /Prova1/src line 27 Semantic Error
Program "g++" not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Built-in Compiler Settings] options C/C++ Scanner Discovery Problem
Program "gcc" not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Built-in Compiler Settings] options C/C++ Scanner Discovery Problem
对于 Problrem 2:
要使用strcpy,strlen等函数,您必须包含字符串头文件。
#include<string.h>
或
#include<cstring>
对于问题 3:
您可以参考这些链接。
Eclipse C++ : "在 PATH 中找不到程序 'g++' "
http://www.eclipse.org/forums/index.php/t/697857/
希望这有帮助。
相关文章:
- Eclipse 问题 - 编译期间不考虑 .c 和 .cpp 文件中定义的预处理
- 找不到 -lpython3.5 -> Eclipse CPP
- 如何将包含多个.cpp源文件的文件夹导入Eclipse项目中,每个源文件都有一个main()定义
- 如何在Eclipse opencv cpp (c ++)上创建.so文件
- 无法解析函数'strlen' - Eclipse cpp
- 我无法在 Eclipse 中为 cpp 存档启用完整内容辅助
- 在 Eclipse ADT 中,我创建了一个新的 cpp 文件并收到"undefined reference"错误
- Eclipse 在添加 .h 和 .cpp 文件后不会构建项目
- 如何始终使用Eclipse编译cpp文件
- 声纳库贝分析在 Eclipse 中失败,由于找不到异常语言"cpp"在本地分析中抛出错误
- Eclipse报告了有效cpp继承的错误
- 在eclipse中,如何创建一个新的cpp文件
- ni/src/SDL/debugger.cpp:1283:13:错误:"int i"之前在此处声明 eclipse
- Eclipse 在使用 freopen 或 fopen CPP 时无法读取文件
- CPP:Eclipse无法识别"长长"类型
- eclipse CPP如何找到mingw安装路径?
- 当项目导入到eclipse中时,.cpp文件被转换为.cc文件
- 无法在eclipse helios中使用静态库创建cpp项目
- Eclipse & Cocos2d-x:我的第一个项目,我更改了 HelloWorldScene.cpp,但已部署的游戏中没有发生更改?
- Eclipse - 无法访问我的文件夹中的 cpp 文件