Compiling examples with VC++ 2010

A place to discuss ARToolKit NFT (version 3 and variants)

Moderator: ARToolKit developers

Compiling examples with VC++ 2010

Postby AGar » Thu Aug 18, 2011 9:31 am

Hi, I am learning my way around AR Pro and NFT.

My installation consists of:
1) ARToolKit Professional version 4.5.2
2) ARToolKit NFT version 3.49.0 (released with VC 2080 .sln but no VC2010 .sln)
3) OpenCV 2.2
4) VC++ 2010

I am able to run simple.exe and simpleNFT.exe from the AR-Pro and AR-NFT bin directories, respectively.
I was able to go through the NFT training process, too, so camera and other exes are working fine.

Now, when I try to 'Build' simpleNFT.c within the VC++2010 solution, I get the following error:

1>------ Build started: Project: simpleNFT, Configuration: Debug Win32 ------
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>AR2d.lib(thread_sub.obj) : error LNK2019: unresolved external symbol __imp__pthread_cond_signal referenced in function _threadStartWait
...plus six similar LNK2019 error lines.
I made sure I included the "C:\Program Files\ARToolKitNFT\win32-i386" folder (where AR2d.lib resides) in the Project Properties (among other folders) but no difference.

I also did a search for the "LIBCMT" statement but found it nowhere in the solution.

Any and all advice is welcome.

Thank you,
AG
Last edited by AGar on Fri Aug 19, 2011 10:58 am, edited 1 time in total.
AGar
 
Posts: 3
Joined: Thu Aug 18, 2011 8:46 am

Re: Compiling examples with VC++ 2010

Postby AGar » Fri Aug 19, 2011 10:52 am

I spent all day battling this issue so I might as well share some of the findings and hope for some feedback on how to do this more efficiently.

First, I updated to the AR software to ARPro 4.5.4 and ARNFT 3.50.0 (with OpenCV2.2)
Ran the VBScript; Saved a copy of bin and example folders.
(the installed simpleLite.exe worked. Simple.exe file did not, out of the box...?? The previoous version's had)

That aside, my goal was simply to be able to compile the most basic example in the AR-Pro suite - simpleLite.c.

In VC++ 2010, I created a "New -> Project from existing code" project and used the .c file from examples-SimpleLite,
which created project files and a Debug folder under examples-SimpleLite.

First Build: Couldn't find (glut.h, config.h)
Added these paths to the Property -> VC++ Directories -> Include and Library Directories:

Under Include:
C:\Program Files\ARToolKit4\include\
C:\Program Files\ARToolKit4\include\win32-i386
C:\Program Files\ARToolKit4\include\AR
C:\OpenCV2.2\include;
C:\OpenCV2.2\include\opencv2;
C:\OpenCV2.2\include\opencv;

Under Libraries:
C:\OpenCV2.2\lib;
C:\Program Files\ARToolKit4\lib;
C:\Program Files\ARToolKit4\lib\win32-i386;
C:\Program Files\ARToolKit4\lib\SRC;

Next Build:
I got 44 LNK2019 errors.
e.g., "error LNK2019: unresolved external symbol _arUtilTimerReset referenced in function _main"

I added these .lib files to the Properties - Linker - Input - Additional Dependencies folder.
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
AR.lib
ARvideo.lib
ARgsub_lite.lib
ARICP.lib
ARMulti.lib
glut32.lib

I probably didn't need the last two.
Note the connection between the header files in the .c file and the files above:
#include <AR/config.h>
#include <AR/video.h>
#include <AR/param.h>
#include <AR/ar.h>
#include <AR/gsub_lite.h>

Next Build:
Error: "warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs..."

.: Go to your project properties->C/C++->Code Generation->Runtime Library and change it to Multi-threaded DLL.

Next Build:
Error:
"MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup"

.: Go to Properties-> Linker-> System-> SubSystem.
Change the "subsystem" in your linker settings from "Windows" to "Console".

Next Build:
Compiles now. .exe starts but fails.

"ARvideo.dll can't be found."
.: Had to copy all DLLs from \bin to my project's Debug folder.


Next Build:
Got many "Cannot find or open the PDB file" errors.
.: Under Tools-> Options-> Debugging-> Symbols, Checkmark the Microsoft Symbol Servers.
It slows things down, though.

Ran Debug:
in DOS window, "Error (2): unable to open camera parameters file "Data/camera_para.dat" for reading."
.: Copy the whole bin\Data folder to the "simpleLite" folder.

And... It finally ran and I got to see my fancy, multicolored cube! :)


Something else that could help if problems continue:
Increase the information in the Build output:
"Tools - Options - Projects and Solutions - Build and Run - MS..build output verbosity"
to something higher than Minimal.

I am pretty sure that I am doing something wrong if I have to go through these many steps.
Please feel free to point out everything I could be doing differently!

Thank you,
AG
AGar
 
Posts: 3
Joined: Thu Aug 18, 2011 8:46 am


Return to ARToolKit NFT (v3.x)

Who is online

Users browsing this forum: No registered users and 1 guest