Fatal error LNK1104: cannot open file 'CppUTest.lib'

451 views
Skip to first unread message

Dave Danenberg

unread,
Dec 18, 2015, 7:07:55 PM12/18/15
to cpputest
Getting cpputest going for first time - using Visual Studio 2010. I know, it looks like I didnt set up the macros or the environment variable correctly. However, I carefully followed the instructions in the WalkThrough doc. Actually deleted and recreated everything a second time. I also went back into the macros and the environment variable - all the paths (names, spelling, syntax, etc) look good.

Anyone else ever run into this?

Dave Danenberg

unread,
Dec 18, 2015, 7:09:39 PM12/18/15
to cpputest
Btw, running on Windows7 and running the latest cpputest (3.7.1)

Charlie Schultz

unread,
Dec 21, 2015, 7:14:40 AM12/21/15
to cpputest
Try linking to CppUTestd.lib

James Grenning

unread,
Dec 21, 2015, 9:02:08 AM12/21/15
to cpputest
Hi Dave

Can you provide the error output?

Is it CppUTest that is not building or your test project that uses
CppUTest? To build CppUTest and run its test, the environment variable
is not needed.

You may get a link error or a copy error. That is due to the project
trying to move the lib to a directory that does not exist.

So, I'm wondering which problem you are trying to fix.

James

--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
> --
> You received this message because you are subscribed to the Google
> Groups "cpputest" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cpputest+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

James Grenning

unread,
Dec 21, 2015, 9:09:53 AM12/21/15
to cpputest
Hi Charlie

That is the right advice. The library name is different than the
project is looking for, and may also be in a different directory.

James

--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
On 21 Dec 2015, at 6:14, Charlie Schultz wrote:

> Try linking to CppUTestd.lib

Dave Danenberg

unread,
Dec 21, 2015, 11:08:51 AM12/21/15
to cpputest
Folks,

Thanks for helping. I did notice that the file in my CppUTest\lib folder is indeed named "CppUTestd.lib" not "CppUTest.lib". I saw that "CppUTestd.lib" gets copied (created?) as part of the build process. So I changed the CPPUTEST_LIB_DEPENDENCIES to "CppUTestd.lib". I also had to change the path name where the project is kept (I had a space in the name of a folder. This was causing and error. Renamed the path to have no spaces).

It now links - and now I get the expected error: Thank you! ...

3>PostBuildEvent:
3>  
3>c:\users\ddanenberg\documents\myvsprojects\gameoflife\unittest\myfirsttest.cpp(9): error : Failure in TEST(FirstTestGroup, FirstTest)
3>   Fail me!
3>  
3>  .
3>  Errors (1 failures, 1 tests, 1 ran, 1 checks, 0 ignored, 0 filtered out, 0 ms)
3>  
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "C:\Users\ddanenberg\Documents\MyVSProjects\GameOfLife\Debug\UnitTest.exe
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.
3>
3>Build FAILED.
Reply all
Reply to author
Forward
0 new messages