[C++-sig] Including C++ classes
Alex Hartog
dobbelsteen56 at hotmail.com
Thu Jun 5 12:59:54 CEST 2008
I am trying to include my own class in a C++ file which is used by boost. For
some reason this does not work. I am certain this is not a C++ issue, because
when I compile it without using boost, it does work.
I am trying to include a simple class:
"camera.h":
#include <string>
using namespace std;
class camera {
public:
camera();
string imagePath;
};
"camera.cpp":
#include "camera.h"
camera::camera(){
}
"main.cpp":
#include "camera.h"
....
camera *c = new camera;
....
When is use bjam, I get the following error message:
E:\Studie\Bachelor Afstudeer Project\Code\voxel_coloring>bjam
warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the
note: directories containing the Expat headers and libraries, respectively.
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
Building Boost.Regex with the optional Unicode/ICU support disabled.
Please refer to the Boost.Regex documentation for more information
(don't panic: this is a strictly optional feature).
...patience...
...found 1176 targets...
...updating 2 targets...
msvc.link.dll bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.pyd
Creating library bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.lib
an
d object bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.exp
voxel_coloring.obj : error LNK2019: unresolved external symbol "public:
__thisca
ll camera::camera(void)" (??0camera@@QAE at XZ) referenced in function "int
__cdecl
voxel_coloring2(class boost::python::list)" (?
voxel_coloring2@@YAHVlist at python@
boost@@@Z)
bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.pyd : fatal error
LNK1120:
1 unresolved externals
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\vcvarsall.ba
t" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin\msvc-9.0
\d
ebug\threading-multi\voxel_coloring_ext.pyd" /IMPLIB:"bin\msvc-9.0
\debug\threadi
ng-multi\voxel_coloring_ext.lib" /LIBPATH:"C:\python25\libs" @"bin\msvc-9.0
\de
bug\threading-multi\voxel_coloring_ext.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
if exist "bin\msvc-9.0\debug\threading-
multi\voxel_coloring_ext.pyd.mani
fest" (
mt -nologo -manifest "bin\msvc-9.0\debug\threading-
multi\voxel_color
ing_ext.pyd.manifest" "-outputresource:bin\msvc-9.0\debug\threading-
multi\voxel_
coloring_ext.pyd;2"
)
...failed msvc.link.dll bin\msvc-9.0\debug\threading-
multi\voxel_coloring_ext.py
d bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.lib...
...removing bin\msvc-9.0\debug\threading-multi\voxel_coloring_ext.lib
...failed updating 2 targets...
If I just declare the class inside my main file, it does not give any
problems. Can anyone help me with this problem?
More information about the Cplusplus-sig
mailing list