无需构建:面向C++的Eclipse问题
Nothing to build: Eclipse Issues for C++
我对Java和Eclipse有一些经验,但我是C++的新手,正在努力自学。如果这是一个简单的问题,或者已经被问到了(尽管我环顾四周了一段时间),我很抱歉。我使用的是Windows 8。
我正在尝试制作一个排序的链表(这相对不重要。)我得到了:
Info: Nothing to build for Working.
这是我的代码:
/*
* SortedList class
*/
#include <string>
#include <fstream>
#include<iostream>
#include "SortedList.h"
using namespace std;
//the ListNode Structure
struct ListNode {
string data;
ListNode *next;
};
//the head of the linked list and the pointer nodes
ListNode head;
ListNode *prev, *current;
// insert a string into the list in alphabetical order
//now adds a string to the list and counts the size of the list
int Insert(string s){
//make the new node
ListNode temp;
temp.data = s;
//the node to traverse the list
prev = &head;
current = head.next;
int c = 0;
//traverse the list, then insert the string
while(current != NULL){
prev = current;
current = current->next;
c++;
}
//insert temp into the list
temp.next = prev->next;
prev->next = &temp;
return c;
}
//Return the number of times a given string occurs in the list.
int Lookup(string s){
return 0;
}
//prints the elements of the list to ostream
void Print(ostream &output){
}
int main( int argc, char ** argv ) {
cout << Insert("a") << endl;
cout << Insert("b") << endl;
cout << Insert("d") << endl;
}
这是我的标题:
using namespace std;
#ifndef SORTEDLIST_H_
#define SORTEDLIST_H_
class SortedList {
public:
// constructor
SortedList();
// modifiers
int Insert(string s);
// other operations
int Lookup(string s) const;
void Print(ostream &output) const;
private:
struct ListNode {
string data;
ListNode *next;
};
// pointer to the first node of the list
ListNode head;
ListNode *prev, *current;
};
#endif /* SORTEDLIST_H_ */
如有任何帮助,我们将不胜感激。
为什么不使用std::deque(在头deque中)?它可能拥有你想要的所有功能,经过充分测试和优化。如果您需要一个具有更多功能的deque,请创建一个从中继承的类,并添加所需的函数。看看http://en.cppreference.com/w/cpp/containe并挑选最适合您需求的容器。
一般来说,如果你需要的东西已经在一些好的、稳定的库(STL、boost、GSL、Armadillo或类似的库)中可用,那么最好使用它,而不是自己从头开始编写+调试+优化它。作为一般建议,将精力集中在应用程序特有的代码上,并重用已经完成的代码(但只有在测试良好的情况下,不要使用糟糕的半熟库)。
相关文章:
- Eclipse 问题 - 编译期间不考虑 .c 和 .cpp 文件中定义的预处理
- eclipse opencv 3.1.0库编译器在Windows上的问题
- Eclipse C 和增强BGL的问题
- 使用 Eclipse 和 minGW 的多个"could not be resolved"问题
- Eclipse CDT 语法着色问题
- C++ 年 Eclipse 中的 CPLEX 问题
- 将 Icon 添加到可执行文件 (Eclipse CDT Luna) 时出现问题:make: *** 没有规则来制作目标 'resources.o'
- 使用 eclipse 创建 jar 文件时出现问题
- Eclipse CDT Juno - 工具链问题
- 使用 Eclipse CDT (Luna) 构建项目时出现问题
- Fedora 19上Eclipse CDT内部链接到SDL2的问题
- eclipse c/c++中的winavr gcc出现问题
- Eclipse C/C++问题+Cygwin(抱怨一切)
- Eclipse在std C++库方面存在问题
- 无需构建:面向C++的Eclipse问题
- Eclipse C/C++CDT恼人的问题
- Visual Studio、CodeBlocks和Eclipse中的C++编译/运行问题
- 在Linux和Eclipse IDE中使用FFTW库的问题
- Eclipse c++ IDE,问题设置
- 为基于Arm的pandboard - es交叉编译设置Eclipse IDE的问题