Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 3 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have copied program on Simulated Annealing from a book (first result link here) and am facing the below issues on compilation, for below line in main().
srand48(tp.tv_usec);
Error on compiling with Dev-C++:
[Error] 'srand48' was not declared in this scope
The full code is at: https://onlinegdb.com/HyruMTmdN.
& the relevant (trimmed version) is stated below:
#include <sys/time.h>
extern double drand48();
extern long lrand48(/*long*/);
extern int rand();
extern void srand(long seedval);
//main program
main()
{
//set random number generator
struct timeval tp;
struct timezone tzp;
gettimeofday(&tp,&tzp);
srand48(tp.tv_usec);
return 1;
}
pop() is a function and is being indexed as if it were a variable. With a quick look there is an array op which might be what’s needed here. So maybe it should be op[x] and not pop[x] in these places?
And when looking at the original that’s how it is. So a copying error by user, should be closed.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I'm currently reading a c++ book and one of the function is
void fp(char v[]){
for(char* p = v; *p!=0;p++) use(*p);
}
I wrote this into my editor and compiled it. I also included the headers
#include <iostream>
#include <string.h>
But my terminal returns the following message:
use of undeclared identifier 'use'
I also google it and its nowhere to be found online, the function doesn't exist.
That's because there is no such standard library function.
The author is either using pseudo-code here, or has defined this function somewhere else in the book.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I keep getting the error "vector does not name type" from one of my classes each time I try to compile my code.
#ifndef DISK
#define DISK
#include "PageTableEntry.h"
#include <vector>
class disk{
private:
Vector <PageTableEntry*> frames;
public:
void addFrame(int Location, PageTableEntry* pte);
void removeFrame(int pteLocation);
Disk();
};
#endif
You should quote errors verbatim. I assume the error is actually more along the lines of Vector does not name type.
You have either not included the declaration for Vector in your code, doing so would provide the compiler with a type, or you have (more likely) mistakenly written Vector when it should be std::vector. Letter case and namespaces matter in C++.
Try:
std::vector<PageTableEntry*> frames;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
following is my code for the program that will print out the random position contained values of nodes of a linked list. The problem is that my list is not printing the complete result. It prints only one result and thus. Please tell me where i am wrong.
int main(){
List* n;
int value=3;
int *counter=0;
collect(value,counter);
for(int i=0; i<&counter; i++);
{
count<<"\n Shuffled: "<< n.pickanddestroy();
}
}
Remove the semicolon at the end of the first line of your for loop.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I declare in a header traductionCSV.h the function
static QVector<struct variableDurSupervision>
listVariableDurSupervison(std::string fichierCSV);
I write it in my cpp, then I want to use it in another file supervision.cpp, so I call it like this :
remplirDurCellule(
traductionCSV::listVariableDurSupervison(
"../../FichierCSV/ListeVariableSupervision.csv"
)
);
But it won't work, I got this error :
undefined reference to traductionCSV::listVariableDurSupervison(std::string)
I properly include all the file, so I don't understand.
Thank you.
You are probably missing the class name when you are defining it in cpp. It should be like :
QVector<struct variableDurSupervision> traductionCSV::listVariableDurSupervison(std::string fichierCSV)
{
...
}
This rule applies both to static and non-static functions of a class.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I got a error message while compiling, saying that
node.h: In member function ‘void binary_tree::print(node*&, std::ofstream&)’:
node.h:17:10: error: ‘node* node::left_child’ is private
But in node.h, the member is public
class node {
public:
char *word;
int frequency;
node *left_child;
node *right_child; };
using MinGW for build and run. Pls help me in solving this issue.
You need to submit complete code for comments.
Error cannot occur if left_child is public. You can clean and rebuild your code.
binary_tree how is this class using class node?
it just worked well!!! but some kinda build error takes here. And this is the altered codes here - https://drive.google.com/file/d/0B5PwxyqEos-wb05vRzhvN21aYTQ/edit?usp=sharing