C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-19-2008, 01:47 PM   #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?
bargomer is offline   Reply With Quote
Old 09-19-2008, 01:50 PM   #2
Banned
 
master5001's Avatar
 
Join Date: Aug 2001
Location: Visalia, CA, USA
Posts: 3,699
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.
master5001 is offline   Reply With Quote
Old 09-19-2008, 01:56 PM   #3
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
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.
matsp is offline   Reply With Quote
Old 09-19-2008, 02:01 PM   #4
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
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).
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 09-19-2008, 02:12 PM   #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.
bargomer is offline   Reply With Quote
Old 09-19-2008, 02:16 PM   #6
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
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...
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
more then 100errors in header hallo007 Windows Programming 20 05-13-2007 08:26 AM
We Got _DEBUG Errors Tonto Windows Programming 5 12-22-2006 05:45 PM
C++ std routines siavoshkc C++ Programming 33 07-28-2006 12:13 AM
load gif into program willc0de4food Windows Programming 14 01-11-2006 10:43 AM
Learning OpenGL HQSneaker C++ Programming 7 08-06-2004 08:57 AM


All times are GMT -6. The time now is 01:50 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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