New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Open
BramVanroy opened this issue
Sep 18, 2018
· 1 comment
· May be fixed by #100
Comments
Trying to build with gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0. Yet another build issue.
- Ubuntu 18.04.1 LTS
- gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
- GNU Make 4.1
[ 88%] Building CXX object extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o
/tmp/cdec/extractor/backoff_sampler.cc: In member function ‘virtual extractor::PhraseLocation extractor::BackoffSampler::Sample(const extractor::PhraseLocation&, const std::unordered_set<int>&) const’:
/tmp/cdec/extractor/backoff_sampler.cc:24:18: error: ‘round’ was not declared in this scope
int sample = round(i);
^~~~~
/tmp/cdec/extractor/backoff_sampler.cc:24:18: note: suggested alternative: ‘rand’
int sample = round(i);
^~~~~
rand
extractor/CMakeFiles/extractor.dir/build.make:86: recipe for target 'extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o' failed
make[2]: *** [extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o] Error 1
CMakeFiles/Makefile2:3227: recipe for target 'extractor/CMakeFiles/extractor.dir/all' failed
make[1]: *** [extractor/CMakeFiles/extractor.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
Confirmed on Ubuntu 18.04.1 LTS amd64 (following this question on AskUbuntu).
Steps to reproduce:
sudo apt-get install cmake git build-essential libboost-dev libboost-regex-dev libboost-filesystem-dev libboost-serialization-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libeigen3-dev libbz2-dev liblzma-dev flex libgtest-dev
cd ~/Downloads
git clone https://github.com/redpony/cdec.git
cd cdec
cmake .
make -j4
Errors:
$ make
[ 6%] Built target utils
[ 7%] Built target atools
[ 8%] Built target weights_test
[ 8%] Built target dedup_corpus
[ 8%] Built target ts
[ 9%] Built target logval_test
[ 10%] Built target sv_test
[ 11%] Built target dict_test
[ 12%] Built target stringlib_test
[ 13%] Built target m_test
[ 13%] Built target small_vector_test
[ 16%] Built target klm_util_double
[ 21%] Built target klm_util
[ 22%] Built target cat_compressed
[ 23%] Built target klm_util_stream
[ 28%] Built target klm
[ 28%] Built target ngram_query
[ 28%] Built target build_binary
[ 29%] Built target dump_counts
[ 32%] Built target lmplz
[ 34%] Built target ksearch
[ 39%] Built target mteval
[ 39%] Built target fast_score
[ 39%] Built target scorer_test
[ 39%] Built target mbr_kbest
[ 59%] Built target libcdec
[ 60%] Built target cdec
[ 61%] Built target trule_test
[ 62%] Built target hg_test
[ 63%] Built target parser_test
[ 63%] Built target grammar_test
[ 63%] Built target t2s_test
[ 64%] Built target lbfgs
[ 64%] Built target ll_test
[ 65%] Built target sentserver
[ 66%] Built target grammar_convert
[ 68%] Built target training_utils
[ 69%] Built target sentclient
[ 70%] Built target mpi_online_optimize
[ 71%] Built target mpi_adagrad_optimize
[ 72%] Built target mpi_extract_reachable
[ 72%] Built target mpi_flex_optimize
[ 73%] Built target mpi_batch_optimize
[ 74%] Built target mpi_compute_cllh
[ 74%] Built target mpi_baum_welch
[ 75%] Built target mpi_extract_features
[ 76%] Built target minrisk_optimize
[ 78%] Built target dpmert
[ 79%] Built target mr_dpmert_map
[ 79%] Built target lo_test
[ 80%] Built target mr_dpmert_reduce
[ 80%] Built target mr_dpmert_generate_mapper_input
[ 81%] Built target mr_pro_reduce
[ 81%] Built target mr_pro_map
[ 82%] Built target dtrain
[ 82%] Built target latent_svm
[ 82%] Built target kbest_cut_mira
[ 83%] Built target kbest_mira
[ 83%] Built target ada_opt_sm
[ 84%] Built target rampion_cccp
[ 85%] Built target argument_reorder_model_trainer
[ 86%] Built target const_reorder_model_trainer
[ 87%] Built target fast_align
[ 88%] Building CXX object extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o
/home/mate/cdec/extractor/backoff_sampler.cc: In member function ‘virtual extractor::PhraseLocation extractor::BackoffSampler::Sample(const extractor::PhraseLocation&, const std::unordered_set<int>&) const’:
/home/mate/cdec/extractor/backoff_sampler.cc:24:18: error: ‘round’ was not declared in this scope
int sample = round(i);
^~~~~
/home/mate/cdec/extractor/backoff_sampler.cc:24:18: note: suggested alternative: ‘rand’
int sample = round(i);
^~~~~
rand
extractor/CMakeFiles/extractor.dir/build.make:86: recipe for target 'extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o' failed
make[2]: *** [extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o] Error 1
CMakeFiles/Makefile2:3227: recipe for target 'extractor/CMakeFiles/extractor.dir/all' failed
make[1]: *** [extractor/CMakeFiles/extractor.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
titsuki
linked a pull request
May 4, 2019
that will
close
this issue
2 participants
Forum Rules |
|
- Forum
- Beginners
- «___ was not declared in this scope» err
«___ was not declared in this scope» errors
I am receiving compiler errors as follows and do not know how to fix this. I know it’s the same type of error, I just don’t exactly know how to fix this error. Thanks in advanced!
main.cpp: In function ‘int main()’:
main.cpp:26:18: error: ‘count’ was not declared in this scope
for (count = 1; count <= 12; count ++);
^
main.cpp:28:13: error: ‘count’ was not declared in this scope
count = count + 1;
^
main.cpp:29:13: error: ‘output’ was not declared in this scope
output count;
^
|
|
Last edited on
You’re getting that error because you hadn’t initialized the ‘count’ variable. Write
int count;
after int payment;
Also replace output count
with cout<<count;
cout is used for console output. There’s nothing called output in STL of C++
Also:
can you explain what you’re trying to do with this block:
|
|
Last edited on
Hello bkatic,
In addition to what Nwb has said you should give this a read http://www.cplusplus.com/doc/tutorial/control/#for
After yo will notice that for loops are generally written as:
|
|
The «int» allows you to define the variable count for use as a local variable in the for loop.
To what you think is in the for loop. Actually nothing because of the semicolon at the end of line 27 that should not be there. What it does is limit the for loop to just that line.
This is what your code looks line in a different way:
|
|
I think this is what you intended:
|
|
What is the point of line 5 in the above code? Between this and the for loop you are adding 2 to count on each iteration of the loop. Adding to count is what the third part of the for condition is for.
Hope that helps,
Andy
Wow, thank you for the responses! I finally got it to work. As to what I’m trying to do with the
|
|
is from the pseudocode my homework assignment gave me. The pseudocode is as follows:
for count 1 to 12
output «Payment Number», count, «: $» , payment.
endfor
For context the assignment is designing an application that accept’s a client’s loan amount and monthly payment amount and outputs the loan balance each month until the loan is paid off.
But after further inspection and your feedback I understand why it doesn’t make sense and I have to switch things around. Thank you again!
So you’re supposed to display
"Payment Number" count ": $" payment
for 12 purchases
( In your for loop you need to add braces like Andy said, but also you don’t need count = count + 1
because count++ in the for parameter does that job for you. You must have been confused with while )
But where will you get the ‘payment’ from? Something is missing because the program accepts only 1 purchase but is asked to display 12 purchases??
Also I didn’t get why «payment = purchasePrice / 12;» is being done.
And I suspect that purchasePrice is supposed to be an array. Also lastName was never assigned, you can’t call it when it’s not assigned.
Topic archived. No new replies allowed.