unit test on vc++ 64 bit application

I try to use boost 1.51 for my vc++ 64 bit application on windows 7
enterprise.
In short, if I set config to 32 bit, everything is OK. I mean build
successfully.
But if I changed to 64 bit, I get build error. I am sure I include the 64
bit header and the lib path is 64 bit lib. My test application is win32
console application.
The error I got:
Error 1 error LNK2019: unresolved external symbol main referenced in
function __tmainCRTStartup D:\Temp\test\test\MSVCRTD.lib(crtexe.obj) test
My test.cpp:
#define BOOST_TEST_MAIN
#include

I am using Visual Studio 2010 on Windows 7 64 bit. My test application is win32 console application -- View this message in context: http://boost.2283326.n4.nabble.com/unit-test-on-vc-64-bit-application-tp4645... Sent from the Boost - Users mailing list archive at Nabble.com.

Hello,
Why 32 bit build and 64 bit would not ? The library I used is from www.boostpro.com.
Important detail. When I tried to use 1.51.0 64 bits from BoostPro, some months ago, I lost several days to try to resolve the same kind of problems. The reason : the libraries announced as 64 bits are actualled compiled in 32 bits... I had to compile them myself.

Thanks. That make sense. -- View this message in context: http://boost.2283326.n4.nabble.com/unit-test-on-vc-64-bit-application-tp4645... Sent from the Boost - Users mailing list archive at Nabble.com.

Thanks. That make sense.
You can check by suing dumpbin.exe. See http://deploytonenyures.blogspot.fr/2011/10/64-bits.html (search for the work "dumpbin")

I have build a 1.53 boost library for x64 and it seems works.
But my unit test still not build successfully. But it looks like different
issue.
I have studio 2010 solution (just for my practice to use Boost Test) which
include two simple win32 applications: one called MyMathApp and one for unit
test called MyMathTest.
In MyMathApp, it has class implemented in mymath.h / mymath.cpp. I want to
unit test it in MyMathTest.
In my MyMathApp, I have TestMyMath.cpp:
#define BOOST_TEST_MAIN
#include

Learning also Boost.Test these days, I started a thread some days ago in this mailing list. I invite you to search and read it. ----- Mail original -----
De: "young"
À: boost-users@lists.boost.org Envoyé: Vendredi 12 Avril 2013 22:13:44 Objet: Re: [Boost-users] unit test on vc++ 64 bit application I have build a 1.53 boost library for x64 and it seems works.
But my unit test still not build successfully. But it looks like different issue.
I have studio 2010 solution (just for my practice to use Boost Test) which include two simple win32 applications: one called MyMathApp and one for unit test called MyMathTest.
In MyMathApp, it has class implemented in mymath.h / mymath.cpp. I want to unit test it in MyMathTest.
In my MyMathApp, I have TestMyMath.cpp:
#define BOOST_TEST_MAIN #include
#include "mymath.h"
BOOST_AUTO_TEST_SUITE(CMyMathTests)
BOOST_AUTO_TEST_CASE (test1) { CMyMath<int> m; BOOST_CHECK(m.add(2,3) == 5); }
BOOST_AUTO_TEST_SUITE_END()
I also add the mymath.h / mymath.cpp to my test project (not physically copy, just add to the project in solution explorer).
When I build it, I got error: error LNK2019: unresolved external symbol "public: static int __cdecl CMyMath<int>::add(int,int)" (?add@?$CMyMath@H@@SAHHH@Z) referenced in function "public: void __cdecl CMyMathTests::test1::test_method(void)" (?test_method@constructortest1@CMyMathTests@@QEAAXXZ)
What I missed?

[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <1365797624390-4645257.post@n4.nabble.com> thusly:
I have build a 1.53 boost library for x64 and it seems works.
But my unit test still not build successfully. But it looks like different issue.
I have studio 2010 solution (just for my practice to use Boost Test) which include two simple win32 applications: one called MyMathApp and one for unit test called MyMathTest.
In MyMathApp, it has class implemented in mymath.h / mymath.cpp. I want to unit test it in MyMathTest.
In my MyMathApp, I have TestMyMath.cpp:
#define BOOST_TEST_MAIN #include
#include "mymath.h"
BOOST_AUTO_TEST_SUITE(CMyMathTests)
BOOST_AUTO_TEST_CASE (test1) { CMyMath<int> m; BOOST_CHECK(m.add(2,3) == 5); }
BOOST_AUTO_TEST_SUITE_END()
I also add the mymath.h / mymath.cpp to my test project (not physically copy, just add to the project in solution explorer).
When I build it, I got error: error LNK2019: unresolved external symbol "public: static int __cdecl CMyMath<int>::add(int,int)" (?add@?$CMyMath@H@@SAHHH@Z) referenced in function "public: void __cdecl CMyMathTests::test1::test_method(void)" (?test_method@constructortest1@CMyMathTests@@QEAAXXZ)
CMyMath is a template class, so all of it's definitions (not just declarations) must be available at the point of instantiation so the compiler can resolve the references. It appears that your definition of CMyMath<T>::add(T,T) is only declared and not defined in the .h you included. Additionally, it appears that this was declared as a static method. That means you didn't need an instance 'm' in order to call it, but there's no harm done in calling it the way you did, just a little confusing to anyone who reads this code as it will read like an instance method but it's a static method that doesn't require an instance. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
participants (3)
-
legalize+jeeves@mail.xmission.com
-
Oodini
-
young