New to Visual Studio 2008

This is a discussion on New to Visual Studio 2008 within the C++ Programming forums, part of the General Programming Boards category; I've been using jGrasp for the past year to compile my programs and I'm switching over to VS. Why can't ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    18

    New to Visual Studio 2008

    I've been using jGrasp for the past year to compile my programs and I'm switching over to VS. Why can't I get any of my old .cpp files to compile? They compile on jgrasp, and I keep getting errors like this:

    Code:
    1>test.obj : error LNK2019: unresolved external symbol "void __cdecl menu(struct Store,int)" (?menu@@YAXUStore@@H@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol "int __cdecl getData(struct Store,int)" (?getData@@YAHUStore@@H@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol "void __cdecl display(struct Store,int)" (?display@@YAXUStore@@H@Z) referenced in function "void __cdecl menu(struct Store * const,int)" (?menu@@YAXQAUStore@@H@Z)
    1>test.obj : error LNK2019: unresolved external symbol "void __cdecl reData(struct Store &,int)" (?reData@@YAXAAUStore@@H@Z) referenced in function "void __cdecl menu(struct Store * const,int)" (?menu@@YAXQAUStore@@H@Z)
    1>C:\Users\Barazin\Documents\Visual Studio 2008\Projects\test2\Debug\test2.exe : fatal error LNK1120: 4 unresolved externals
    Also, is there a way to avoid having to use cin.get() so I'm able to see my code execute?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    When you run it via debug, it should automatically require user input at the end of execution. May I see your code so I can appropriately answer your question.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The errors you are seeing looks like your project doesn't have all the source files it needs (particularly, you have a menu function call in main, but the compiler can't find the actual menu function - I'm guessing that the menu function is in a different file and that this file is not part of your project definition - you need to use "add file..." to add the file to your project).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,167
    Quote Originally Posted by bargomer View Post
    Also, is there a way to avoid having to use cin.get() so I'm able to see my code execute?
    Run without debug (Ctrl + F5) or set a breakpoint at the end of main (F9) and debug (F5).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    18
    I found the reason for it not compiling. Apparently you cannot copy and paste code into the source file after you already built the solution.

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,167
    Hm?
    I get the feeling that it's something else that you did...
    Building the solution just compiles the code. Of course you must be able to recompile the code after you've compiled it before...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21