Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,059 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,536 people online right now. Registration is fast and FREE... Join Now!




early Console app wont run in Visual Studio

 
Reply to this topicStart new topic

early Console app wont run in Visual Studio, code runs on one program but not another

zartek
4 Aug, 2008 - 03:05 PM
Post #1

New D.I.C Head
*

Joined: 29 May, 2008
Posts: 19


My Contributions
im trying to figure out why my code wont compile in VS2008 but will in DEVC++ both are windows programs running on my macs vmfusion. am i doing something wrong?

CODE


#include <iostream>
using namespace std;


main()
{
    int greydon;


    greydon = 45;

    cout << "greydon = " << greydon << endl;

    return 0;

}





Please let me know if i am doing something wrong.
Zartek Galicia

User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Early Console App Wont Run In Visual Studio
4 Aug, 2008 - 03:12 PM
Post #2

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,522



Thanked: 96 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
When working in VC, you need to include a new header.

Try adding this:
#include "stdafx.h"

Hope this helps smile.gif
User is offlineProfile CardPM
+Quote Post

zartek
RE: Early Console App Wont Run In Visual Studio
4 Aug, 2008 - 03:17 PM
Post #3

New D.I.C Head
*

Joined: 29 May, 2008
Posts: 19


My Contributions
QUOTE(gabehabe @ 4 Aug, 2008 - 04:12 PM) *

When working in VC, you need to include a new header.

Try adding this:
#include "stdafx.h"

Hope this helps smile.gif


hey whats up, i tried adding that file, right below the directive code
still the same result here are the errors im getting.

------ Build started: Project: 1pro, Configuration: Debug Win32 ------
Compiling...
1pro.cpp
c:\documents and settings\administrator\desktop\programming\new folder\1pro\1pro\1pro.cpp(3) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\Programming\New Folder\1pro\1pro\Debug\BuildLog.htm"
1pro - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



not sure what im doing wrong
User is offlineProfile CardPM
+Quote Post

KYA
RE: Early Console App Wont Run In Visual Studio
4 Aug, 2008 - 03:49 PM
Post #4

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 4,776



Thanked: 91 times
Dream Kudos: 1200
My Contributions
QUOTE(gabehabe @ 4 Aug, 2008 - 04:12 PM) *

When working in VC, you need to include a new header.

Try adding this:
#include "stdafx.h"

Hope this helps smile.gif


Nope that's not necessary. Unless one needs it, that just creates more problems. try int main()

or the window is executing and closing fast in which case try:

cpp

char input;
cin >> input; //will hold window open for you


User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 06:18PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month