Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Visual C++ vs Dev C++

  • 08-04-2009 3:01pm
    #1
    Closed Accounts Posts: 7,134 ✭✭✭


    Sorry for this N0b question

    but I have installed Visual C++ as it was recommended to be better than the outdated Dev C++

    But im lost.

    here is what happens when you create a new console app

    include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {

    }

    wtf...

    I copied and pasted my working code from Dev C, but all errors pop up, where do I put in the includes, <stdlib,iostream etc>..???


Comments

  • Closed Accounts Posts: 2,219 ✭✭✭Lab_Mouse


    I switched over from dev c++,visual takes abit of getting use to..
    any way to get a blank project...

    right click file->new projext->win32console application(enter name of project)hit enter->dont click finish select next->you will see under extra options select empty project->and then finish.

    You now have a blank project.

    All you includes should go at top of file as usual..
    #include<iostream>
    
    using namespace std;
    
    int main()
    {
    //some code
    }
    

    and this is precompiled for windows proggramming
    include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    
    }
    

    hope that helped


  • Registered Users, Registered Users 2 Posts: 2,013 ✭✭✭lynchie


    By default MSVC uses precompiled headers so place any includes in stdafx.h. Otherwise turn off precompiled headers in the project settings and remove the stdafx.h include.


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    This is a disaster to run..!

    I did all that, created an empty project, there's nothing on the screen. not even a work space to type.


  • Registered Users, Registered Users 2 Posts: 515 ✭✭✭NeverSayDie


    You probably need to add a file to your project, if you went with the empty project suggestion above - "empty project" means no files :) A project in Visual Studio is a container of sorts - holds all your code files, resources, build configuration, settings, etc.

    Can't recall where exactly, but either the File menu -> New File, or right click on your project on the treeview display over to the right and select "Add New Item". You should be able to add CPP files, headers and so on that way.

    It's probably confusing at first if you're not used to it, but a lot of IDEs work in a broadly similar way in terms of "projects" containing files, build info, etc, so it's worth getting the hang of. MS have lots of video tutorials to go along with Visual Studio Express editions, I'd recommend checking a few of those out, they're aimed at beginners and should help you get started.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Another IDE you might like to consider is CodeBlocks, seems to be the latest kid on the block. Dev-CPP is no longer updated.

    http://www.codeblocks.org/


  • Advertisement
  • Closed Accounts Posts: 2,219 ✭✭✭Lab_Mouse


    This is a disaster to run..!

    I did all that, created an empty project, there's nothing on the screen. not even a work space to type.

    sorry my fault forgot to mention that you had to add source files or header files.So use to just flying thru the set up process!

    if its not to late you will see in a menu on right hand side thr project solution as MS call it.Should be 3 sub branches(Headers,resouirce and source).Right click source and select new file(.cpp)or for headers select header right click and select new file(.h)

    Stick with it though!I find its a good IDE(but jaysus I have never seen so many menu's!).

    AS for code::blocks I have also heard it is very good but have never tried using it


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    Lab_Mouse wrote: »
    sorry my fault forgot to mention that you had to add source files or header files.So use to just flying thru the set up process!

    if its not to late you will see in a menu on right hand side thr project solution as MS call it.Should be 3 sub branches(Headers,resouirce and source).Right click source and select new file(.cpp)or for headers select header right click and select new file(.h)

    Stick with it though!I find its a good IDE(but jaysus I have never seen so many menu's!).

    AS for code::blocks I have also heard it is very good but have never tried using it


    Damn this program, seems too fancy for me! is the syntax different to dev c++ as I added a new source file and pasted a basic program from dev c++ into it, and it wouldnt complile, didnt recognise things like semi colons and what not.?

    what do you suggest lab mouse.?!


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    What are the errors?


  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    "1>
    Build started: Project: 1, Configuration: Debug Win32
    1>Compiling...
    1>my world.cpp
    1>c:\documents and settings\eric\my documents\visual studio 2008\projects\1\1\my world.cpp(14) : error C2059: syntax error : ';'
    1>Build log was saved at "file://c:\Documents and Settings\eric\My Documents\Visual Studio 2008\Projects\1\1\Debug\BuildLog.htm"
    1>1 - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    "

    !!


  • Registered Users, Registered Users 2 Posts: 1,916 ✭✭✭ronivek


    http://msdn.microsoft.com/en-us/library/t8xe60cf(VS.80).aspx

    It's telling you the line number and the error code... it shouldn't be that difficult to narrow it down but paste the code here if you can't figure it out.


  • Advertisement
  • Closed Accounts Posts: 7,134 ✭✭✭x in the city


    thanks guys

    Feel such a nob


    this line

    cout << " Enter an Integer: \n" ;

    had an << at the end,

    dummies book did things like this

    cout << " blah " << endl;

    so I guess this does it differently

    it seems a much more complex and complete package than dev c++ tho


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    There shouldn't be any real differences in basic code syntax from DevCPP's mingw and MS's compiler.

    cout << " blah " << endl; should work providing you placed a "using namespace std;" on top.

    You really should avoid using \n. Use the endl instead. A bit less efficient as it does the flushing for you but better off stick to the C++ standards and not be going back to C ;)

    Yes Visual Studio would be a bigger package than Dev C++. Most of the stuff you won't use however for basic programs.


Advertisement