Thread: can compile in terminal but not from VS 2005 IDE, please help.

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    3

    Question can compile in terminal but not from VS 2005 IDE, please help.

    hello!
    win7 x86 with VS 2005

    i'm following along an example and they use a terminal window to compile and run the code. the command to compile the code is...

    cl testDMC-class.cpp dmc-class.cpp Galil1.lib -EHsc -MD

    i looked up the -EHsc part and it has to do with 'exception handling' but not at all sure what the other stuff does.

    the people who write the example say that i should be able to compile the code using the Visual Studio IDE but when i hit F5 i get three errors which occur right after it says 'linking...'

    any ideas of what i need to do to get the code running from within VS2005?
    many thanks for reading

    the errors are here...
    1>dmc-class.obj : error LNK2019: unresolved external symbol "public: __thiscall Galil::Galil(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0Galil@@QAE@V?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall Controller::Controller(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Controller@@QAE@ABV?$basic_string@DU?$char_tra its@D@std@@V?$allocator@D@2@@std@@@Z)
    1>dmc-class.obj : error LNK2019: unresolved external symbol "public: double __thiscall Galil::commandValue(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?commandValue@Galil@@QAENABV?$basic_string@DU?$ch ar_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: double __thiscall Controller::Any_Command(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?Any_Command@Controller@@QAENAAV?$basic_string@DU ?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
    1>dmc-class.obj : error LNK2019: unresolved external symbol "public: __thiscall Galil::~Galil(void)" (??1Galil@@QAE@XZ) referenced in function "public: void * __thiscall Galil::`scalar deleting destructor'(unsigned int)" (??_GGalil@@QAEPAXI@Z)
    1>C:\Users\bobby blobby\Dropbox\Masters Thesis\Code\galil\galilADV\Debug\galilADV.exe : fatal error LNK1120: 3 unresolved externals

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You've got two files on your command line ("testDMC-class.cpp" and "dmc-class.cpp"). You need both of those files to be in your project if you want your project to build.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Actually, given that the errors seem to reference this Galil class, I'm betting that the Galil1.lib library file needs to be added as a dependency.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    3
    sorry for being nOOb, how do i do that?

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    1) Go to your projects settings.


    2) If you have the library file in a location other than where the IDE has placed it's own library files, you'll first need to specify the location where your library file exists:can compile in terminal but not from VS 2005 IDE, please help.-step1-jpg


    3) Then, you'll need to add the name - in this case Galil1.lib - as a dependency:
    can compile in terminal but not from VS 2005 IDE, please help.-step2-jpg
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  6. #6
    Registered User
    Join Date
    May 2011
    Posts
    3
    thank you sooooo much for that.
    i had done the first part but not the second.

    know what a pain it is to screen grab, circle then UL so much appreciated!!

    +1000 for u!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. compile prog from terminal
    By codecaine_21 in forum C Programming
    Replies: 9
    Last Post: 10-06-2010, 09:31 PM
  2. Visual Studio 2005 - Debug code with compile errors?
    By Swerve in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-17-2008, 08:12 AM
  3. How to compile .c files with Visual C# Express 2005
    By daYz in forum Windows Programming
    Replies: 2
    Last Post: 02-22-2008, 10:37 AM
  4. Compile Error in Visual C++ 2005 express
    By Fremontknight1 in forum C++ Programming
    Replies: 9
    Last Post: 10-19-2007, 04:28 PM
  5. VC++ 2005 Beta Compile problems
    By mrowlings in forum C++ Programming
    Replies: 5
    Last Post: 03-28-2005, 04:02 PM