Solved

How to link subproject library into the executeable in Visual Studio

Posted on 2014-01-26
10
438 Views
Last Modified: 2014-01-26
I have a project that I create a number of subprojects in Visual Studio c++ 2013.  I have defined the project dependency and build order.  However I still have unresolved external reference.  What can be a problem.  What else should I check.

Thanks.
0
Comment
Question by:tommym121
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 39810317
What exactly does the error message look like?
0
 

Author Comment

by:tommym121
ID: 39810325
appmain.obj : error LNK2019: unresolved external symbol "public: __thiscall configSettings::configSettings(void)" (??0configSettings@@QAE@XZ) referenced in function _wmain
9>appmain.obj : error LNK2019: unresolved external symbol "public: void __thiscall configSettings::load(char const *)" (?load@configSettings@@QAEXPBD@Z) referenced in function _wmain
9>appmain.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall configSettings::DataServer_IP(void)" (?DataServer_IP@configSettings@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function _wmain
9>appmain.obj : error LNK2019: unresolved external symbol "public: int __thiscall configSettings::DataServer_Port(void)" (?DataServer_Port@configSettings@@QAEHXZ) referenced in function _wmain
0
 

Author Comment

by:tommym121
ID: 39810329
And this is my configSettings class

class configSettings
{

private:
      std::string m_logLevel;      // log level Config.level
      bool m_logToConsole;         // log to console Config.logToConsole
      bool m_logToFile;                   // log to file Config.logToFile
      std::string m_DataServerIP;  // Data Server IP address Config.dataServerIP
      std::string m_logPath;             // Log directory/Path Config.LogPath
      int m_DataServerPort;             // DataServer Port number Config.dataServerPort
public:
      configSettings();
      void load(const std::string &filename);      
      void load(const char *filename);
      void save(const std::string &filename);

      int LogLevel();
      bool LogToFile();
      bool LogToConsole();
      std::string DataServer_IP();
      int DataServer_Port();


};
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:jkr
ID: 39810336
Ah, OK, so name mangling can be ruled out. Is your 'configSettings' class within a static library or a DLL? If the latter applies, are you exporting it correctly and using the import library?
0
 

Author Comment

by:tommym121
ID: 39810341
Please see the atttachment.
Capture.JPG
0
 
LVL 86

Expert Comment

by:jkr
ID: 39810350
OK. How are you linking that library to executable? Did you add that 'configSettings.lib' as 'Additional Library' in the app's settings? Also, did you do that for both the 'Debug' and 'Release' configuration?
0
 

Author Comment

by:tommym121
ID: 39810379
not working.  I have set Link Depenedency Yes
0
 

Author Comment

by:tommym121
ID: 39810381
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 39810392
Well, Setting 'Yes' isn't really enough, you need to specify the lib by name. Assuming that 'Additional Library Directories' contains the path where 'configSettings.lib' resides, try adding

#pragma comment(lib, "configSettings.lib")

Open in new window

0
 

Author Closing Comment

by:tommym121
ID: 39810562
Thanks.  It works.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question