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

    [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    Hi,

    I installed Boost Library 1.51.0 and installed BoostPro binary library (boost_1_51)

    The following is my code

    Code:
    #include <string>
    #include <iostream>
    #include <boost/thread.hpp>
    
    using namespace boost;
    using namespace std;
    
    
    int main(){
    
    }
    This generates the following error


    Code:
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(160): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(160): error C2065: 'tuple' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(160): error C2059: syntax error : '>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(161): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(161): error C2447: '{' : missing function header (old-style formal list?)
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2065: 'tuple' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : 'const'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2447: '{' : missing function header (old-style formal list?)
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2065: 'tuple' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2275: 'A1' : illegal use of this type as an expression
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : 'const'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2065: 'tuple' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2275: 'A1' : illegal use of this type as an expression
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2275: 'A2' : illegal use of this type as an expression
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2275: 'A3' : illegal use of this type as an expression
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : 'const'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2039: 'tuple' : is not a member of 'std'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2988: unrecognizable template declaration/definition
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(176): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(184): error C2065: 'T' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(184): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(184): error C2447: '{' : missing function header (old-style formal list?)
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(365): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(365): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/functional/hash/extensions.hpp(365): error C2059: syntax error : '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread.hpp(45): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread.hpp(45): error C2447: '{' : missing function header (old-style formal list?)
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(39): error C2143: syntax error : missing ';' before '*'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(39): error C2238: unexpected token(s) preceding ';'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(45): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(45): error C2143: syntax error : missing ';' before '<end Parse>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(45): warning C4183: 'create_thread': missing return type; assumed to be a member function returning 'int'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(48): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(56): error C2061: syntax error : identifier 'thread'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(58): error C2061: syntax error : identifier 'm'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2065: 'thread' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2059: syntax error : '>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2039: 'iterator' : is not a member of '`global namespace''
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2065: 'threads' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2065: 'thrd' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(59): error C2143: syntax error : missing ',' before ')'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(61): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(63): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(64): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(67): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(70): error C2065: 'thread' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(70): error C2059: syntax error : '>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(70): error C2039: 'iterator' : is not a member of '`global namespace''
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(70): error C2065: 'threads' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(70): error C2143: syntax error : missing ',' before ';'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(72): error C2059: syntax error : ')'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(73): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(75): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(76): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(79): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(82): error C2065: 'thread' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(82): error C2059: syntax error : '>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(82): error C2039: 'iterator' : is not a member of '`global namespace''
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(82): error C2065: 'threads' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(82): error C2143: syntax error : missing ',' before ';'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(84): error C2059: syntax error : ')'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(85): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(87): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(88): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(91): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(94): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(97): error C2065: 'thread' : undeclared identifier
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(97): error C2059: syntax error : '>'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(99): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/thread/detail/thread_group.hpp(100): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(131): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(141): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(148): error C2653: 'EnumType' : is not a class or namespace name
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(149): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(156): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(161): error C2653: 'EnumType' : is not a class or namespace name
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(162): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(174): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(176): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(191): error C2653: 'EnumType' : is not a class or namespace name
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(192): error C2143: syntax error : missing ';' before '{'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(194): error C2143: syntax error : missing ';' before '}'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\boost_1_51_0\boost_1_51\boost/detail/scoped_enum_emulation.hpp(194): fatal error C1003: error count exceeds 100; stopping compilation
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:01.45
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    if I remove the reference to Boost thread library, it builds successfully
    I could build successfully with reference to other libraries like
    Code:
    boost/function.hpp
    any suggestions? thanks

  2. #2
    Join Date
    Oct 2009
    Posts
    37

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    I narrowed down the problem to a conflict between different C++ libraries

    If I remove libpqxx library references in VS project properties, then boost works correctly. If I include it, then the above error in my original post occurs

    Anyway to include other libraries without adding all the entries in "Additional Include Libraries"?

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    Quote Originally Posted by Momentum View Post
    If I remove libpqxx library references in VS project properties, then boost works correctly. If I include it, then the above error in my original post occurs
    The /showIncludes option when compiling your program will show you where the errors are occurring.

    Also, you're using the term "library" incorrectly as those errors are compiler errors, not linker errors. A library is something that is used at link time, not compile time.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; September 16th, 2012 at 06:56 AM.

  4. #4
    Join Date
    Oct 2009
    Posts
    37

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    thanks for the reply and clarification. I was able to figure it out using \showincludes

    Like I said before, if I removed the libpqxx library from the "Additional Includes Library" field in project properties, leaving only the boost library, I could successfully build and compile code.

    In this project, I noticed that I'm able to use objects from the libpqxx library and build/compile successfully, without having the "Additional Includes Library" field setup to reference the libpqxx. Unlike in a previous project, where I had to set it up as a local project property. So I don't expect other VS projects to be able to reference the libpqxx library, unless I set it up in their project property

    The \showincludes results show that the project is referencing the libpqxx and I'm able to successfully use the #include declarative, though I did not setup the "Additional Includes Library" field to do so. I only configure the linker properties to reference the libpqxx library

    Why is that? Does VS cache the path for all libraries used in previous projects?
    if so, in terms of using libraries, why is there a distinction between having local project properties settings for the library and global project properties where all your projects will be able to reference a specified library
    Last edited by Momentum; September 16th, 2012 at 12:23 PM.

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    Quote Originally Posted by Momentum View Post
    Why is that? Does VS cache the path for all libraries used in previous projects?
    The C++ compiler include path has nothing to do with the linker include path -- they are two totally separate entities and must be set accordingly.

    The bottom line is that the C++ compiler (CL.EXE) knows nothing about the linker (LINK.EXE), and the linker knows nothing about the C++ compiler. When the compiler compiles the code, the compiler on success creates .obj files that are located somewhere -- the compiler does nothing else.

    The linker now needs to be told where those obj files are located, along with any necessary .lib files needed to link successfully. This step is not done by the C++ compiler -- you have to do that manually (in this case "manually" means you have to set the project linker settings).

    Regards,

    Paul McKenzie

  6. #6
    Join Date
    Oct 2009
    Posts
    37

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    understood.

    How come I did not need to setup the "Additional Includes Library" field to use the libpqxx library?

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    Quote Originally Posted by Momentum View Post
    understood.

    How come I did not need to setup the "Additional Includes Library" field to use the libpqxx library?
    There exists a #pragma in Visual C++"
    Code:
    #pragma comment (lib, "libraryname")
    This allows specifying the library to use instead of setting it via the project settings. Maybe somewhere this pragma is used by the boost header files.

    Regards,

    Paul McKenzie

  8. #8
    Join Date
    Oct 2009
    Posts
    37

    Re: [boost/thread.hpp] Boost Library 1.51.0 Error in Visual Studio 2010

    ok, thanks for the help and clarification

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