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

Managed C++/CLI

 
GeneralRe: Need to Know about Pin
Luc Pattyn18-Jun-09 13:42
sitebuilderLuc Pattyn18-Jun-09 13:42 
QuestionATL Server Web Service on Vista / IIS 7 and VS2005 Pin
Condorito17-Jun-09 7:53
Condorito17-Jun-09 7:53 
QuestionShould all classes have an interface base class? Pin
LetsMond16-Jun-09 7:17
LetsMond16-Jun-09 7:17 
AnswerRe: Should all classes have an interface base class? Pin
led mike16-Jun-09 8:37
led mike16-Jun-09 8:37 
GeneralRe: Should all classes have an interface base class? Pin
LetsMond17-Jun-09 1:57
LetsMond17-Jun-09 1:57 
GeneralRe: Should all classes have an interface base class? Pin
led mike17-Jun-09 6:00
led mike17-Jun-09 6:00 
AnswerRe: Should all classes have an interface base class? Pin
Dave Doknjas16-Jun-09 14:24
Dave Doknjas16-Jun-09 14:24 
GeneralRe: Should all classes have an interface base class? Pin
LetsMond17-Jun-09 1:16
LetsMond17-Jun-09 1:16 
GeneralRe: Should all classes have an interface base class? Pin
led mike17-Jun-09 4:25
led mike17-Jun-09 4:25 
QuestionRe: Should all classes have an interface base class? Pin
led mike18-Jun-09 4:31
led mike18-Jun-09 4:31 
AnswerRe: Should all classes have an interface base class? Pin
Dave Doknjas18-Jun-09 4:48
Dave Doknjas18-Jun-09 4:48 
GeneralRe: Should all classes have an interface base class? Pin
led mike18-Jun-09 5:07
led mike18-Jun-09 5:07 
AnswerRe: Should all classes have an interface base class? Pin
Luc Pattyn17-Jun-09 5:16
sitebuilderLuc Pattyn17-Jun-09 5:16 
QuestionHow to access a variable inside another thread? [modified] Pin
Nikhil_777715-Jun-09 15:56
Nikhil_777715-Jun-09 15:56 
AnswerRe: How to access a variable inside another thread? Pin
N a v a n e e t h15-Jun-09 18:02
N a v a n e e t h15-Jun-09 18:02 
QuestionRe: How to access a variable inside another thread? Pin
Nikhil_777716-Jun-09 5:38
Nikhil_777716-Jun-09 5:38 
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 

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.