Discussion:
[test] Fatal link error LNK1561: entry point must be defined when using boost.test
Tjernstrom, Staffan
2008-07-18 11:35:05 UTC
Permalink
(Resend with modified subject to better match list standards)

Folks,

Hopefully this is me having finger trouble, but I can't seem to get around the problem.

Boost 1.35 installed using the binary installer, all the vc8 flavours installed.

What happens is that I try to compile / link any of the unit test examples in Visual Studio 2005 Pro, for example the code at

http://www.boost.org/doc/libs/test/example/unit_test_example_05.cpp

I keep getting the LNK1561: entry point must be defined error. I know that it's looking for, and picking up, the libboost_unit_test_framework-vc80-mt-1_35.lib as if I remove the /LIBPATH from the link command options it compains that it cannot find that library.

I have my project settings set as follows:

Compiler:
/O2 /GL /I "C:\Program Files (x86)\boost\boost_1_35_0" /D "_MBCS" /FD /EHa /MD /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Wp64 /Zi /TP /errorReport:prompt

Linker:
/OUT:"D:\staffan\Documents\Visual Studio 2005\Projects\CeT3x\test\AllUnitTests\Release\test_XOLibrary.exe" /NOLOGO /LIBPATH:"C:\Program Files (x86)\boost\boost_1_35_0\lib" /MANIFEST /MANIFESTFILE:"Release\test_XOLibrary.exe.intermediate.manifest" /DEBUG /PDB:"d:\staffan\Documents\Visual Studio 2005\Projects\CeT3x\test\AllUnitTests\release\test_XOLibrary.pdb" /OPT:REF /OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Any thoughts anyone?

Rgds

Staffan Tj.

Staffan Tjernström | Sr. Software Engineer - Market Data Systems | www.esignal.com <http://www.esignal.com/>
eSignal, Interactive Data Desktop Solutions (NYSE: IDC)
3955 Point Eden Way | Hayward, CA 94545-3720 | 510.723.1723 | FAX: 510.266.6100




DISCLAIMER: This message (including any files transmitted with it) may contain confidential and / or proprietary information, is the property of Interactive Data Corporation and / or its subsidiaries and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution or use of this message, or any attachments, is prohibited and may be unlawful.
John C. Femiani
2008-07-18 16:55:56 UTC
Permalink
Post by Tjernstrom, Staffan
What happens is that I try to compile / link any of the unit test
examples in Visual Studio 2005 Pro, for example the code at
http://www.boost.org/doc/libs/test/example/unit_test_example_05.cpp
Every time I try to click on a unit test example link I have been
getting a 404 error :(
Can other people use links like this?
Post by Tjernstrom, Staffan
I keep getting the LNK1561: entry point must be defined error. I know
that it's looking for, and picking up, the
libboost_unit_test_framework-vc80-mt-1_35.lib as if I remove the
/LIBPATH from the link command options it compains that it cannot find
that library.
/O2 /GL /I "C:\Program Files (x86)\boost\boost_1_35_0" /D "_MBCS" /FD
/EHa /MD /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Wp64 /Zi
/TP /errorReport:prompt
/OUT:"D:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\Release\test_XOLibrary.exe"
/NOLOGO /LIBPATH:"C:\Program Files (x86)\boost\boost_1_35_0\lib"
/MANIFEST
/MANIFESTFILE:"Release\test_XOLibrary.exe.intermediate.manifest"
/DEBUG /PDB:"d:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\release\test_XOLibrary.pdb"
/OPT:REF /OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Any thoughts anyone?
Does it work if BOOST_TEST_MAIN is defined?

--John Femiani
Tjernstrom, Staffan
2008-07-19 00:51:49 UTC
Permalink
No, unless I also define BOOST_TEST_DYN_LINK, but then I have to copy across the boost test dll (it's not picked up in the manifest by default).

As far as I can tell, the culprit seems to be the following in <boost/test/unit_test.hpp>

//____________________________________________________________________________//

// ************************************************************************** //
// ************** Auto Linking ************** //
// ************************************************************************** //

#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED)
# define BOOST_LIB_NAME boost_unit_test_framework

# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK)
# define BOOST_DYN_LINK
# endif

# include <boost/config/auto_link.hpp>

#endif // auto-linking disabled

// ************************************************************************** //
// ************** unit_test_main ************** //
// ************************************************************************** //

namespace boost { namespace unit_test {

int BOOST_TEST_DECL unit_test_main( init_unit_test_func init_func, int argc, char* argv[] );

}}

#if defined(BOOST_TEST_DYN_LINK) && defined(BOOST_TEST_MAIN) && !defined(BOOST_TEST_NO_MAIN)

// ************************************************************************** //
// ************** main function for tests using dll ************** //
// ************************************************************************** //

int BOOST_TEST_CALL_DECL
main( int argc, char* argv[] )
{
return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
}

//____________________________________________________________________________//

#endif // BOOST_TEST_DYN_LINK && BOOST_TEST_MAIN && !BOOST_TEST_NO_MAIN

Rgds

Staffan Tj.

Staffan Tjernström | Sr. Software Engineer - Market Data Systems | www.esignal.com
eSignal, Interactive Data Desktop Solutions (NYSE: IDC)
3955 Point Eden Way | Hayward, CA 94545-3720 | 510.723.1723 | FAX: 510.266.6100


-----Original Message-----
From: boost-users-***@lists.boost.org [mailto:boost-users-***@lists.boost.org] On Behalf Of John C. Femiani
Sent: Friday, 18 July, 2008 09:56
To: boost-***@lists.boost.org
Subject: Re: [Boost-users] [test] Fatal link error LNK1561: entry point must be defined when using boost.test
Post by Tjernstrom, Staffan
What happens is that I try to compile / link any of the unit test
examples in Visual Studio 2005 Pro, for example the code at
http://www.boost.org/doc/libs/test/example/unit_test_example_05.cpp
Every time I try to click on a unit test example link I have been getting a 404 error :( Can other people use links like this?
Post by Tjernstrom, Staffan
I keep getting the LNK1561: entry point must be defined error. I know
that it's looking for, and picking up, the
libboost_unit_test_framework-vc80-mt-1_35.lib as if I remove the
/LIBPATH from the link command options it compains that it cannot find
that library.
/O2 /GL /I "C:\Program Files (x86)\boost\boost_1_35_0" /D "_MBCS" /FD
/EHa /MD /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Wp64 /Zi
/TP /errorReport:prompt
/OUT:"D:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\Release\test_XOLibrary.exe"
/NOLOGO /LIBPATH:"C:\Program Files (x86)\boost\boost_1_35_0\lib"
/MANIFEST
/MANIFESTFILE:"Release\test_XOLibrary.exe.intermediate.manifest"
/DEBUG /PDB:"d:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\release\test_XOLibrary.pdb"
/OPT:REF /OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Any thoughts anyone?
Does it work if BOOST_TEST_MAIN is defined?

--John Femiani
_______________________________________________
Boost-users mailing list
Boost-***@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users


DISCLAIMER: This message (including any files transmitted with it) may contain confidential and / or proprietary information, is the property of Interactive Data Corporation and / or its subsidiaries and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution or use of this message, or any attachments, is prohibited and may be unlawful.
John C. Femiani
2008-07-19 01:27:57 UTC
Permalink
Post by Tjernstrom, Staffan
No, unless I also define BOOST_TEST_DYN_LINK, but then I have to copy across the boost test dll (it's not picked up in the manifest by default).
As far as I can tell, the culprit seems to be the following in <boost/test/unit_test.hpp>
<snip>
Post by Tjernstrom, Staffan
Post by Tjernstrom, Staffan
I keep getting the LNK1561: entry point must be defined error. I know
that it's looking for, and picking up, the
libboost_unit_test_framework-vc80-mt-1_35.lib as if I remove the
/LIBPATH from the link command options it compains that it cannot find
that library.
Open a VS command prompt window, go to the lib folder, and type:

dumpbin libboost_unit_test_framework-vc80-mt-1_35.lib /LINKERMEMBER >
symbols.txt

Then open symbols.txt and search for _main.

If its missing, try rebuilding the lib.

--John
Steven Watanabe
2008-07-19 04:35:18 UTC
Permalink
AMDG
Post by John C. Femiani
Post by Tjernstrom, Staffan
What happens is that I try to compile / link any of the unit test
examples in Visual Studio 2005 Pro, for example the code at
http://www.boost.org/doc/libs/test/example/unit_test_example_05.cpp
Every time I try to click on a unit test example link I have been
getting a 404 error :( Can other people use links like this?
I get the same error. The correct link is
http://www.boost.org/doc/libs/1_35_0/libs/test/example/unit_test_example_05.cpp

In Christ,
Steven Watanabe
Ovanes Markarian
2008-07-19 19:38:20 UTC
Permalink
The problem here is that you set to link against dynamic version of C++
runtime and you want boost to link against static version of boost lib. This
will not work.

Please select either another compilation switch (Project Properties / C++ /
Code Generation) and choose there non-DLL version of runtime, like
Multi-Threaded Library and not as currently Multi-Threaded Library DLL. This
should change your compiler switch from /MD to /MT.

C++ will afterwards look for the satic version of the test library, which
has the prefix libboost_*.lib instead of boost_*.lib


Good Luck,
Ovanes
Post by Tjernstrom, Staffan
I keep getting the LNK1561: entry point must be defined error. I know that
it's looking for, and picking up, the
libboost_unit_test_framework-vc80-mt-1_35.lib as if I remove the /LIBPATH
from the link command options it compains that it cannot find that library.
/O2 /GL /I "C:\Program Files (x86)\boost\boost_1_35_0" /D "_MBCS" /FD /EHa
/MD /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Wp64 /Zi /TP
/errorReport:prompt
/OUT:"D:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\Release\test_XOLibrary.exe" /NOLOGO
/LIBPATH:"C:\Program Files (x86)\boost\boost_1_35_0\lib" /MANIFEST
/MANIFESTFILE:"Release\test_XOLibrary.exe.intermediate.manifest" /DEBUG
/PDB:"d:\staffan\Documents\Visual Studio
2005\Projects\CeT3x\test\AllUnitTests\release\test_XOLibrary.pdb" /OPT:REF
/OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Any thoughts anyone?
Rgds
*Staffan Tj.*
Staffan Tjernström | Sr. Software Engineer - Market Data Systems |
www.esignal.com*
eSignal*, Interactive Data Desktop Solutions (NYSE: IDC)
3955 Point Eden Way | Hayward, CA 94545-3720 | 510.723.1723 | FAX: 510.266.6100
------------------------------
DISCLAIMER: This message (including any files transmitted with it) may
contain confidential and / or proprietary information, is the property of
Interactive Data Corporation and / or its subsidiaries and is directed only
to the addressee(s). If you are not the designated recipient or have reason
to believe you received this message in error, please delete this message
from your system and notify the sender immediately. An unintended
recipient's disclosure, copying, distribution or use of this message, or any
attachments, is prohibited and may be unlawful.
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
John C. Femiani
2008-07-20 22:27:03 UTC
Permalink
Post by Ovanes Markarian
The problem here is that you set to link against dynamic version of
C++ runtime and you want boost to link against static version of boost
lib. This will not work.
Please select either another compilation switch (Project Properties /
C++ / Code Generation) and choose there non-DLL version of runtime,
like Multi-Threaded Library and not as currently Multi-Threaded
Library DLL. This should change your compiler switch from /MD to /MT.
I dont think that is the problem because he is linking with
libboost_unit_test_framework-vc80-mt-1_35.lib, and since there is no
'-s' in the name, it links with MSVCRT, and it is selected by boost
autolink when you use option /MD and and you are not compiling DEBUG code.

Plus, it works flawlessly on my system.

I _did_ notice a difference between our liker options; You don't have
the subsystem set. When I throw together an msvc project I get this
linker option:

/SUBSYTEM:CONSOLE

If I remove that option, I get:

1>LINK : fatal error LNK1561: entry point must be defined

Personally, I never even paid attention to it before (the defaults
always worked for me), but I guess that is probably your problem.

open your project properties, and change Linker->System->SubSystem from
[Not Set] to '/SUBSYSTEM:CONSOLE', or just manually add it to the
command line and see if that works.

--John
Tjernstrom, Staffan
2008-07-22 03:25:07 UTC
Permalink
Thank you very much indeed.

The missing /SUBSYSTEM: was indeed my problem.

This came about because I created the unit test projects as empty projects in VS, not MFC console projects.

Rgds

Staffan Tj.

Staffan Tjernström | Sr. Software Engineer - Market Data Systems | www.esignal.com
eSignal, Interactive Data Desktop Solutions (NYSE: IDC)
3955 Point Eden Way | Hayward, CA 94545-3720 | 510.723.1723 | FAX: 510.266.6100


-----Original Message-----
From: boost-users-***@lists.boost.org [mailto:boost-users-***@lists.boost.org] On Behalf Of John C. Femiani
Sent: Sunday, 20 July, 2008 15:27
To: boost-***@lists.boost.org
Subject: Re: [Boost-users] [test] Fatal link error LNK1561: entry point must be defined when using boost.test
Post by Ovanes Markarian
The problem here is that you set to link against dynamic version of
C++ runtime and you want boost to link against static version of boost
lib. This will not work.
Please select either another compilation switch (Project Properties /
C++ / Code Generation) and choose there non-DLL version of runtime,
like Multi-Threaded Library and not as currently Multi-Threaded
Library DLL. This should change your compiler switch from /MD to /MT.
I dont think that is the problem because he is linking with libboost_unit_test_framework-vc80-mt-1_35.lib, and since there is no '-s' in the name, it links with MSVCRT, and it is selected by boost autolink when you use option /MD and and you are not compiling DEBUG code.

Plus, it works flawlessly on my system.

I _did_ notice a difference between our liker options; You don't have the subsystem set. When I throw together an msvc project I get this linker option:

/SUBSYTEM:CONSOLE

If I remove that option, I get:

1>LINK : fatal error LNK1561: entry point must be defined

Personally, I never even paid attention to it before (the defaults always worked for me), but I guess that is probably your problem.

open your project properties, and change Linker->System->SubSystem from [Not Set] to '/SUBSYSTEM:CONSOLE', or just manually add it to the command line and see if that works.

--John

_______________________________________________
Boost-users mailing list
Boost-***@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users


DISCLAIMER: This message (including any files transmitted with it) may contain confidential and / or proprietary information, is the property of Interactive Data Corporation and / or its subsidiaries and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution or use of this message, or any attachments, is prohibited and may be unlawful.
Loading...