[try Beta version]
Not logged in

 
compiling problem

Jun 3, 2011 at 6:26am
i m tyring to compiling the program of variables but it shows some errors and i have written everything same as the input of variables on this site what should i do can any1 help me please.
below is the input which i used for programming and in which i m encountering problem plz help me...

input:-

// operating with variables

#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result:
cout << result;

// terminate the program:
return 0;
}

please help me regarding this
Jun 3, 2011 at 6:47am
what does the error message display?
Jun 3, 2011 at 10:46pm
Perhaps you're having the same issue as described in this thread? http://www.cplusplus.com/forum/beginner/44202/
Jun 3, 2011 at 10:50pm
closed account (zb0S216C)
Your error definitely doesn't reside in the code you posted.

What IDE are you using? and what error message( s ) are you receiving?

Wazzak
Jun 3, 2011 at 10:57pm
I literally copied and pasted this based on what you posted:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result:
cout << result;

// terminate the program:
return 0;
}


I didn't modify anything, and the code ran fine for me. As shekhartanwar mentioned, could you please share your error message with us?
Last edited on Jun 6, 2011 at 7:17pm
Jun 3, 2011 at 11:07pm
closed account (zb0S216C)
Based on Zero One's experience, it's more than likely it's the common Stdafx error. You can disable the Stdafx header. Simply follow my instructions below.

Instructions:
1) Open your project options
2) Under the C/C++ node, select: Precompiled Headers
3) In the first field, choose the option: Not Using Precompiled Headers.


Make sure you do the same for both Debug and Release versions.

Wazzak
Last edited on Jun 3, 2011 at 11:07pm
Topic archived. No new replies allowed.