Click here to Skip to main content
15,892,161 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: How to access a variable inside another thread? Pin
Mark Salsbery16-Jun-09 6:01
Mark Salsbery16-Jun-09 6:01 
AnswerRe: How to access a variable inside another thread? Pin
killabyte18-Jun-09 3:34
killabyte18-Jun-09 3:34 
GeneralRe: How to access a variable inside another thread? Pin
Nikhil_777718-Jun-09 4:58
Nikhil_777718-Jun-09 4:58 
QuestionListView in c++ windows forms applications Pin
wael_r14-Jun-09 22:26
wael_r14-Jun-09 22:26 
AnswerRe: ListView in c++ windows forms applications Pin
led mike15-Jun-09 4:24
led mike15-Jun-09 4:24 
QuestionEncryption / Decryption Pin
queries36513-Jun-09 10:02
queries36513-Jun-09 10:02 
AnswerRe: Encryption / Decryption Pin
Luc Pattyn13-Jun-09 10:13
sitebuilderLuc Pattyn13-Jun-09 10:13 
Question[newbie] error C2065: 'b' : undeclared identifier Pin
jon-8013-Jun-09 4:16
professionaljon-8013-Jun-09 4:16 
Any idea why doesn't this compile?

// SieveOfErathostenes.cpp : main project file.

#include "stdafx.h"
#include <bitset>
#include <iostream>
#include <ctime>

using namespace System;

int main(array<System::String ^> ^args)
{
    const int N = 2000000;
    clock_t cstart = clock();

    bitset<N + 1> b;
    int count = 0;
    int i;
    for (i = 2; i <= N; i++)
        b.set(i);
    i = 2;

    while (i * i <= N)
    {
        if (b.test(i))
        {
            count++;
            int k = 2 * i;
            while (k <= N)
            {
                b.reset(k);
                k += i;
            }
        }
        i++;
    }

    while (i <= N)
    {
        if (b.test(i))  count++;
        i++;
    }

    clock_t cend = clock();
    double millis = 1000.0 * (cend - cstart) / CLOCKS_PER_SEC;

    cout << count << " primes \n" << millis << " milliseconds\n";

    return 0;
}


Errors:
Error 4 error C2065: 'b' : undeclared identifier c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 19 SieveOfErathostenes


Error 5 error C2228: left of '.set' must have class/struct/union c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 19 SieveOfErathostenes


Error 6 error C2065: 'b' : undeclared identifier c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 24 SieveOfErathostenes


Error 7 error C2228: left of '.test' must have class/struct/union c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 24 SieveOfErathostenes


Error 8 error C2065: 'b' : undeclared identifier c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 30 SieveOfErathostenes


Error 9 error C2228: left of '.reset' must have class/struct/union c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 30 SieveOfErathostenes


Error 10 error C2065: 'b' : undeclared identifier c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 39 SieveOfErathostenes


Error 11 error C2228: left of '.test' must have class/struct/union c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 39 SieveOfErathostenes


Error 12 error C2065: 'cout' : undeclared identifier c:\Users\Administrator\Documents\Visual Studio 2008\Projects\SieveOfErathostenes\SieveOfErathostenes\SieveOfErathostenes.cpp 46 SieveOfErathostenes

NOTE:
1. Core Java Vol I 8th Ed. Pg. 713 (727)




Jon

AnswerRe: [newbie] error C2065: 'b' : undeclared identifier Pin
Luc Pattyn13-Jun-09 4:46
sitebuilderLuc Pattyn13-Jun-09 4:46 
GeneralRe: [newbie] error C2065: 'b' : undeclared identifier Pin
jon-8013-Jun-09 4:52
professionaljon-8013-Jun-09 4:52 
GeneralRe: [newbie] error C2065: 'b' : undeclared identifier Pin
Randor 13-Jun-09 5:15
professional Randor 13-Jun-09 5:15 
GeneralRe: [newbie] error C2065: 'b' : undeclared identifier Pin
jon-8013-Jun-09 5:18
professionaljon-8013-Jun-09 5:18 
GeneralRe: [newbie] error C2065: 'b' : undeclared identifier Pin
Luc Pattyn13-Jun-09 14:32
sitebuilderLuc Pattyn13-Jun-09 14:32 
AnswerRe: [newbie] error C2065: 'b' : undeclared identifier Pin
N a v a n e e t h13-Jun-09 4:48
N a v a n e e t h13-Jun-09 4:48 
Question[newbie] error C2065: 'b' : undeclared identifier Pin
jon-8013-Jun-09 4:12
professionaljon-8013-Jun-09 4:12 
AnswerRe: [newbie] error C2065: 'b' : undeclared identifier Pin
dybs13-Jun-09 5:20
dybs13-Jun-09 5:20 
QuestionDataGrid1 column width Pin
wael_r12-Jun-09 23:36
wael_r12-Jun-09 23:36 
QuestionRunning apps remotely (CLI) Pin
See_Sharp12-Jun-09 10:51
See_Sharp12-Jun-09 10:51 
AnswerRe: Running apps remotely (CLI) Pin
Randor 12-Jun-09 12:55
professional Randor 12-Jun-09 12:55 
GeneralRe: Running apps remotely (CLI) Pin
See_Sharp12-Jun-09 13:30
See_Sharp12-Jun-09 13:30 
QuestionLabel flickering Pin
cherrymotion11-Jun-09 21:56
cherrymotion11-Jun-09 21:56 
AnswerRe: Label flickering Pin
Luc Pattyn12-Jun-09 2:59
sitebuilderLuc Pattyn12-Jun-09 2:59 
GeneralRe: Label flickering Pin
cherrymotion12-Jun-09 3:34
cherrymotion12-Jun-09 3:34 
GeneralRe: Label flickering Pin
Luc Pattyn12-Jun-09 3:40
sitebuilderLuc Pattyn12-Jun-09 3:40 
GeneralRe: Label flickering Pin
cherrymotion12-Jun-09 4:34
cherrymotion12-Jun-09 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.