2016-05-29 27 views
0

Ecplipseでcppが新しくなりました。私は多くの問題を抱えています。関数 'strlen'を解決できませんでした - Eclipse cpp

固定:1)最初にdafaultのINCLUDING FOLDERはありませんでした。

Eclipseのジップをアンパックしましたが、ライブラリ(またはインクルード)がないので、インクルードフォルダのDEV(MinGWがインストールされ、それらも含まれています)で「パスとシンボル」を設定しました。 これを行うと、私は含めての問題を修正しました。

は固定されていません。)

は3を固定されていない、私が設定した "あまりにも(GCC)PATHには見られない "" プログラム" G ++
を2) "解決できませんでした関数 'strlenを'"ビンとPATH:DEV、mingwのとmingwの/ MSYSフォルダ...しかし、コードは問題ではありません期待して

#include <iostream> 
#include <stdlib.h> 
#include "D:\Documenti\funz.cpp" 
#include "D:\Documenti\winfunz.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 vuota\n"; 
     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'; 
    }}; 

動作しませんでした。

エラーProblrem 2については

Description Resource Path Location Type 
    Cannot run program "sh" (in directory "E:\CPP\workspace\Prova1"): 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 

答えて

2

などのstrcpy、strlen関数、などの機能を使用するには、文字列のヘッダファイルをインクルードする必要があります。

問題3については
#include<string.h> 

または

#include<cstring> 

あなたはこれらのリンクを参照することができます。

Eclipse C++ : "Program "g++" not found in PATH"

http://www.eclipse.org/forums/index.php/t/697857/

この情報がお役に立てば幸いです。

+0

- g ++/gccの問題を修正しました----------------------- - #include は他のインクルードではdifiniteなので問題ありません。------------------------- - 私が(エラーで)実行しようとすると、Eclipseがmake.exeに見つかりませんでしたので、私はシステムに合格しましたウィンドウ内の "path"変数 - > preferencies - > * ....と動作します!!!! -----------------------今、私はまだ持っています2つの問題:不足している文字列ライブラリとコンソール: "make:***ターゲットが指定されておらず、メークファイルが見つかりません。停止。 " – frisk

関連する問題