Hello,
I'm learning to develop a Houdini plugin with C++. I haven't got any problems to compile with hcustom or with a makefile for one cpp file. But, when I try to compile 2 or more cpp files, I have an error of multiple definition on houdini library.
The unique solution I've find for the moment to compile several C++ file is… include cpp file in the main file and just compile this one :?
This is my makefile:
# Installation directory.
INSTDIR = $(HOME)/houdini11.0
# List of C++ source files to build.
SOURCES = \
./src/ParticleEmiter.C \
./src/ParticuleGeometry.C
# Use the highest optimization level.
OPTIMIZER = -g
# Set the plugin library name.
DSONAME = SIM_ParticleEmiter.so
# Include the GNU Makefile.
include $(HFS)/toolkit/makefiles/Makefile.gnu
all: SIM_ParticleEmiter.so
When I compile with this file, I've this error:
g++ -shared ./src/ParticleEmiter.o ./src/ParticleGeometry.o -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXext -lXi -ldl -lpthread -oSIM_ParticleEmiter.so
./src/ParticleGeometry.o: In function `new_allocator':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new:94: multiple definition of `HoudiniDSOVersion'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/UT/UT_DSOVersion.h:64: first defined here
./src/ParticleGeometry.o: In function `HoudiniCompilerVersion':
/opt/hfs11.0.446.9/toolkit/include/UT/UT_DSOVersion.h:80: multiple definition of `HoudiniCompilerVersion'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/UT/UT_DSOVersion.h:80: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<UT_Matrix4T<float> >(GB_GenericData const&, UT_Matrix4T<float>&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:275: multiple definition of `bool GVEXimportData<UT_Matrix4T<float> >(GB_GenericData const&, UT_Matrix4T<float>&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:275: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<UT_Matrix3T<float> >(GB_GenericData const&, UT_Matrix3T<float>&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:274: multiple definition of `bool GVEXimportData<UT_Matrix3T<float> >(GB_GenericData const&, UT_Matrix3T<float>&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:274: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<UT_Vector4T<float> >(GB_GenericData const&, UT_Vector4T<float>&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:273: multiple definition of `bool GVEXimportData<UT_Vector4T<float> >(GB_GenericData const&, UT_Vector4T<float>&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:273: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<UT_Vector3T<float> >(GB_GenericData const&, UT_Vector3T<float>&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:272: multiple definition of `bool GVEXimportData<UT_Vector3T<float> >(GB_GenericData const&, UT_Vector3T<float>&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:272: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<UT_Vector2T<float> >(GB_GenericData const&, UT_Vector2T<float>&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:271: multiple definition of `bool GVEXimportData<UT_Vector2T<float> >(GB_GenericData const&, UT_Vector2T<float>&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:271: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<double>(GB_GenericData const&, double&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:270: multiple definition of `bool GVEXimportData<double>(GB_GenericData const&, double&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:270: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<float>(GB_GenericData const&, float&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:269: multiple definition of `bool GVEXimportData<float>(GB_GenericData const&, float&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:269: first defined here
./src/ParticleGeometry.o: In function `bool GVEXimportData<int>(GB_GenericData const&, int&)':
/opt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:268: multiple definition of `bool GVEXimportData<int>(GB_GenericData const&, int&)'
./src/ParticleEmiter.oopt/hfs11.0.446.9/toolkit/include/GB/GB_GenericData.h:268: first defined here
collect2: ld returned 1 exit status
make: *** Error 1
My configuration is GNU/Linux Cent OS x64 and I compile with gcc.x86_64 version 4.1.2-48.el5 (i can't update this)
Thank.
Makefile compilation error with 2 or more files
8279 10 1- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
- edward
- Member
- 7899 posts
- Joined: 7月 2005
- Offline
Try the “Compiling with Makefiles” section here
http://www.sidefx.com/docs/hdk11.0/hdk_intro_compiling.html [sidefx.com]
http://www.sidefx.com/docs/hdk11.0/hdk_intro_compiling.html [sidefx.com]
- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
- edward
- Member
- 7899 posts
- Joined: 7月 2005
- Offline
- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
Apparently, no. I've just understand version of gcc depend of houdini version.
For CentOS 5, just gcc 4.1 version houdini is possible.
I test with Ubuntu 10.04 to use gcc4.4 for Houdini but on VMware, the software don't start, I have a fatal error:
Fatal error: Segmentation Fault
I don't know if it's an error to vmware, I'll try on an Ubuntu's partition.
For CentOS 5, just gcc 4.1 version houdini is possible.
I test with Ubuntu 10.04 to use gcc4.4 for Houdini but on VMware, the software don't start, I have a fatal error:
Fatal error: Segmentation Fault
I don't know if it's an error to vmware, I'll try on an Ubuntu's partition.
- larsvdb
- Member
- 19 posts
- Joined: 3月 2010
- Offline
make sure you include
#include <UT/UT_DSOVersion.h>
#include <OP/OP_Operator.h>
#include <OP/OP_OperatorTable.h>
only onces in the project. anywhere else will give you a error.
best solution is to have a main file where you define it.
something like.
#include <UT/UT_DSOVersion.h>
#include <OP/OP_Operator.h>
#include <OP/OP_OperatorTable.h>
#include “SOP_CollapseSetup.h”
#include “SOP_CollapseSim.h”
#include “SOP_CollapseTransform.h”
void newSopOperator(OP_OperatorTable *table) {
table->addOperator(new OP_CollapseSetupOperator());
table->addOperator(new OP_CollapseSimOperator());
table->addOperator(new OP_CollapseTransformOperator());
}
means you will need to remove the newSopOperator functions from your files but thats how i got it to work on linux and OSX.
#include <UT/UT_DSOVersion.h>
#include <OP/OP_Operator.h>
#include <OP/OP_OperatorTable.h>
only onces in the project. anywhere else will give you a error.
best solution is to have a main file where you define it.
something like.
#include <UT/UT_DSOVersion.h>
#include <OP/OP_Operator.h>
#include <OP/OP_OperatorTable.h>
#include “SOP_CollapseSetup.h”
#include “SOP_CollapseSim.h”
#include “SOP_CollapseTransform.h”
void newSopOperator(OP_OperatorTable *table) {
table->addOperator(new OP_CollapseSetupOperator());
table->addOperator(new OP_CollapseSimOperator());
table->addOperator(new OP_CollapseTransformOperator());
}
means you will need to remove the newSopOperator functions from your files but thats how i got it to work on linux and OSX.
- Pagefan
- Member
- 519 posts
- Joined:
- Offline
- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
- kikou
- Member
- 25 posts
- Joined: 12月 2005
- Offline
Hi,
You should define NEED_SPECIALIZATION_STORAGE when compiling with gcc4.1 for Houdini 11. That fixed the issue for me.
See http://www.sidefx.com/docs/hdk11.0/_g_b___generic_data_8h_source.html [sidefx.com] (line 256)
You should define NEED_SPECIALIZATION_STORAGE when compiling with gcc4.1 for Houdini 11. That fixed the issue for me.
See http://www.sidefx.com/docs/hdk11.0/_g_b___generic_data_8h_source.html [sidefx.com] (line 256)
Frederic Servant / Solid Angle / London
www.solidangle.com
www.solidangle.com
- Calysto
- Member
- 10 posts
- Joined: 8月 2010
- Offline
-
- Quick Links