Error round was not declared in this scope

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/...

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

@BramVanroy

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

@N0rbert

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
titsuki

linked a pull request

May 4, 2019

that will
close
this issue

2 participants

@N0rbert

@BramVanroy

  • Home
  • VBForums
  • Visual Basic
  • Visual Basic 6 and Earlier
  • [RESOLVED] Getting error : Round is not declared ….

  1. Jun 28th, 2012, 05:47 AM


    #1

    VBLearner6 is offline

    Thread Starter


    Fanatic Member


    Resolved [RESOLVED] Getting error : Round is not declared ….

    The following code generate error: Round is not declared ….

    Private Sub Command1_Click()
    Dim dNum As Double
    dNum = 95.33266545
    Text1.Text =

    Round(dNum, 2) & «%»
    End Sub

    How to modify it?

    Thanks.


  2. Jun 28th, 2012, 05:52 AM


    #2

    Re: Getting error : Round is not declared ….

    the round function works fine, the code is corect, but i dont knw why it is not working, u may try this
    edited: i think u r not using VB6 is it?

    Last edited by seenu_1st; Jun 28th, 2012 at 05:56 AM.


  3. Jun 28th, 2012, 05:54 AM


    #3

    Re: Getting error : Round is not declared ….

    check menu > project > references
    look for any missing references and remedy

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  4. Jun 28th, 2012, 06:02 AM


    #4

    Re: Getting error : Round is not declared ….

    Perhaps you’ve overloaded the global definition somewhere by declaring something as Round elsewhere in your program. You can work around this by using VBA.Round to resolve the ambiguity you introduced.

    However since you’re only trying to create a String expression anyway (relying on implicit type coercion, not the best policy when programming) why not use one of the many functions for doing this?

    If you had a proper fractional value you could just use FormatPercent$, but for some reason you’ve already prescaled your value by 100. You can also use Format$ once again being clever in order to un-do your prescaling.

    For example:

    Code:

    Dim dNum As Double
    dNum = 0.9533266545 'No prescaling!
    Text1.Text = FormatPercent$(dNum, 2) & "%"

    Or:

    Code:

    Dim dNum As Double
    dNum = 0.9533266545 'No prescaling!
    Text1.Text = Format$(dNum, "0.00%")

    Or in your case you have to unravel your prescaling:

    Code:

    Dim dNum As Double
    dNum = 95.33266545
    Text1.Text = Format$(dNum, "0.00%")


  5. Jun 28th, 2012, 06:48 AM


    #5

    VBLearner6 is offline

    Thread Starter


    Fanatic Member


    Re: Getting error : Round is not declared ….

    I am sorry. Actually I am using it on vb.net. It is working fine on vb6. What can I do now? Shall I post this question on vb.net?

    Thanks.


  6. Jun 28th, 2012, 06:51 AM


    #6

    Re: Getting error : Round is not declared ….

    Ahh. Yes, asking in a VB.Net forum might get you faster answers.


  7. Jun 28th, 2012, 06:53 AM


    #7

    VBLearner6 is offline

    Thread Starter


    Fanatic Member


    Re: Getting error : Round is not declared ….

    Quote Originally Posted by seenu_1st
    View Post

    the round function works fine, the code is corect, but i dont knw why it is not working, u may try this

    edited: i think u r not using VB6 is it?

    Thanks. It’s working fine. Actually I used it in vb.net.

    Regards.


  8. Jun 28th, 2012, 08:08 AM


    #8

    Re: [RESOLVED] Getting error : Round is not declared ….

    may be this help, i m not sure this wil work or not, just try…

    Code:

    Visual Basic (Declaration) 
    Public Shared Function Round (d As Decimal) As Decimal


  9. Jun 28th, 2012, 04:36 PM


    #9


  • Home
  • VBForums
  • Visual Basic
  • Visual Basic 6 and Earlier
  • [RESOLVED] Getting error : Round is not declared ….


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules


Click Here to Expand Forum to Full Width

  • 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;
^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <cstdlib>
#include <string>
    using namespace std;
    int main()
    {
            int acctNum;
            string firstName;
            string lastName;
            int purchasePrice;
            int payment;
           
            
            cout << "Please enter account number";
            cin >> acctNum;
            cout << "Please enter customer's first name";
            cin >> firstName;
            cout << "Please enter purchase price";
            cin >> purchasePrice;
            
            payment = purchasePrice / 12;
            cout << "Customer first name:" << firstName <<endl;
            cout << "Customer last name:" << lastName <<endl;
            cout << "Account number:" << acctNum <<endl;
            
            for (count = 1; count <= 12; count ++);
            cout << "Payment number";
            count = count + 1;
            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:

1
2
3
4
            for (count = 1; count <= 12; count ++);
            cout << "Payment number";
            count = count + 1;
            output count;

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:

1
2
3
4
for (int count = 1; count <= 12; count++)
{
    // <--- your code here.
}

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:

1
2
3
4
5
6
7
for (count = 1; count <= 12; count++);

cout << "Payment number";
	
count = count + 1;
	
output count;

I think this is what you intended:

1
2
3
4
5
6
7
8
for (int count = 1; count <= 12; count++)
{
	cout << "Payment number";

	count = count + 1;

	output count;
}

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

1
2
3
4
for (count = 1; count <=12; count ++)
cout << "Payment number";
count = count + 1;
cout << count; 

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.

Понравилась статья? Поделить с друзьями:
  • Error rom file size incorrect
  • Error rom file romid is not compatible with existing bios romid перевод
  • Error role cannot be dropped because some objects depend on it detail privileges for database
  • Error rockstar games social club was not detected при установке патча
  • Error roblox wiki