CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    9

    relitivly new to C++, need something explaining

    Hi, i am relitely new to C++ using visual studio and am studying it as part of a course in University.

    I am also learning C# which i have managed to pick up quite quickly but when it comes to C++ i seem to be totally stumped. not sure if its the way i'm taught or what but anyways to my problem:

    I have been asked to learn how to do some basic linked lists ok, now i managed to find a few examples but nothing seems to want to work for me.

    I persume when i start a new project i use the command line with precompiled headers ticked but some some strange reason when i copy and paste the example given into VS and run it i keep getting an error message saying:

    "did you forget to add #include<stdafx.h> as a namespace to your source"


    After this i then looked at my code, i already have a header file called stdafx.h and still my program wont run.

    i then started a new project and unticked pre compiled headers, this time it throws aload of errors because obviously theres stuff i have included which need stdafx.h to run.

    I then thought ok i just add #include <stdafx.h> to the top of my code like the other namespaces and i still get aload of errors involving the cout function and loads of syntax errors.

    Anyways, i can include my code if you want and you can probably tell me what has gone wrong. If not this example i have looks like a really good example as it allows me to insert into the list, delete etc. which is really what im after.

    I hope somebody can help and i can post the code, its abit long which is why i havent posted it on here.

    d you need code or can you tell me exactly whats gone wrong?

    thanks and sorry about the daft question just annoys me the fact ive copied and pasted a whole code snippet and i get a silly precompiled error, this has happened with the last 5 or 6 code snippets i have tried to use.
    Last edited by Sharkadder; October 29th, 2007 at 08:03 AM.

  2. #2
    Join Date
    May 2007
    Posts
    811

    Re: relitivly new to C++, need something explaining

    Why don't you take small steps, first create new console project and just have plain main function in it and see if that compiles. If this is working that you can start experimenting more. IOW, before you get into complex stuff you do need to make sure that you understand simple thinks and how they work.

    It also does help to specify which compiler you are using.

  3. #3
    Join Date
    Oct 2007
    Posts
    9

    Re: relitivly new to C++, need something explaining

    i would do small steps as you said but unfortunetly for me they are demanding that we do linked lists and whats even more good news is they won't tell us how to do it either, abit sad yes but i searched the internet and none of the example i find will work, not even the small examples i have found, i just get missing pre compiled error messages.

    I am using Visual studio so i just use the compiler within that and have tried some command line programs to do with arrays and they all work, just when i do linked lists none of the programs will work.

    If i'm honest i think its the cout function which messes up but it happens same here and at uni so i'm abit stumped.

    Do you think you could create me a basic linked list program, maybe 20lines long or something? then i can study it and see if it works.

  4. #4
    Join Date
    May 2007
    Posts
    811

    Re: relitivly new to C++, need something explaining

    By small steps I meant that you can spend an hour or two getting familiar with your Development Environment (in your case that is VC++) and by doing this and getting to work, then you can start concentrating on your assignment of creating a linked list.

    As you already see, that you are guessing what might be wrong. In C++ this will only give you more grief.

    As far as writing the code for you, sorry but this I will not do. It would be helpful if you post you code here (please use code tags for it, if you don't know how, look in the FAQ) and what version of VC++ you are using, then we can go over it together.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured