|
From: | Allahyari Rahim |
Subject: | Re: mkoctfile problem |
Date: | Tue, 20 Jan 2009 08:21:31 +0000 (GMT) |
hello I have
command mkoctfile –v TWUsetUserAgent.cc >
mkoctfile -v TWUsetUserAgent.cc mingw32-g++-4.3.0-dw2
-c -march=i686 -mtune=i686
-IC:\Programme\Octave\3.0.2_gcc-4.3.0\include\octave-3.0.2 -IC:\Progra mme\Octave\3.0.2_gcc-4.3.0\include\octave-3.0.2\octave
-IC:\Programme\Octave\3.0.2_gcc-4.3.0\include -mieee-fp -D_DLL -O 2
-Wall TWUsetUserAgent.cc -o
TWUsetUserAgent.o mingw32-g++-4.3.0-dw2
-shared -shared-libgcc -Wl,--export-all-symbols -Wl,--enable-auto-import
-Wl,--enable-runtime-pseu do-reloc -o TWUsetUserAgent.oct TWUsetUserAgent.o -LC:\Programme\Octave\3.0.2_gcc-4.3.0\lib\octave-3.0.2
-LC:\Progra mme\Octave\3.0.2_gcc-4.3.0\lib
-loctinterp -loctave -lcruft
-shared-libgcc -llapack -lblas -lfftw3 -lreadline -lncurse s -lhdf5
-lz -lm -lstdc++_s -lws2_32 -lkernel32 -lgfortran -lstdc++_s TWUsetUserAgent.o:TWUsetUserAgent.cc:(.text+0x4d6):
undefined reference to `_TWUsetUserAgent' collect2:
ld returned 1 exit status octave-3.0.2.exe:65:C:\Programme\Octave > I try to compile
this code // TWUsetUserAgent.cc #include <octave/oct.h> #include "TWUsetUserAgent.h" DEFUN_DLD(TWUsetUserAgent, args, ,
"") {
octave_value retval; if
(args.length() == 1) {
std::string ua = args(0).string_value(); if (!
error_state) {
retval = std::string(TWUsetUserAgent(ua.c_str())); } } else
print_usage(); return
retval; } // TWUsetUserAgent.h #ifndef TWUSETUSERAGENT_H #define TWUSETUSERAGENT_H #ifdef
__cplusplus extern "C" { #endif
typedef char const * TWUsetUserAgent_t(char const * );
TWUsetUserAgent_t TWUsetUserAgent; #ifdef
__cplusplus } #endif #endif and // TWUsetUser.c #include "TWUsetUserAgent.h" char
const * TWUsetUserAgent(char const * new_user_agent) { char
const* user_agent_name; if(
new_user_agent && *new_user_agent
&& ( 81 > strlen(new_user_agent))) {
user_agent_name = new_user_agent; }
return user_agent_name; } I have
compiled program with msvc und build TWUClib.lib and TWUClib.dll If I use mkoctfile
TWUsetUserAgent.cc, then it’s with following error >
mkoctfile TWUsetUserAgent.cc TWUsetUserAgent.o:TWUsetUserAgent.cc:(.text+0x4d6):
undefined reference to `_TWUsetUserAgent' collect2:
ld returned 1 exit status octave-3.0.2.exe:66:C:\Programme\Octave Ok link
error my header file can not find TWUsetUser.c If I try the
code like following to write // TWUsetUserAgent.h #ifndef TWUSETUSERAGENT_H #define TWUSETUSERAGENT_H #ifdef
__cplusplus extern "C" { #endif
typedef char const * TWUsetUserAgent_t(char const * );
TWUsetUserAgent_t TWUsetUserAgent; #ifdef
__cplusplus } #endif #endif char const * TWUsetUserAgent(char const *
new_user_agent) { char
const* user_agent_name; if(
new_user_agent && *new_user_agent
&& ( 81 > strlen(new_user_agent))) {
user_agent_name = new_user_agent; }
return user_agent_name; } Then it’s
is ok but it is not normal I need to call a lot of source. I have to call
either my TWUClib.lib or direct connect to TWUsetUser.c Thanks --- Tatsuro MATSUOKA <address@hidden> schrieb am Di, 20.1.2009: Von: Tatsuro MATSUOKA <address@hidden> |
[Prev in Thread] | Current Thread | [Next in Thread] |