大家好,我正在尝试将我在VS2010(c ++)中创建的多文件项目转换为python.我已设法链接Python26.lib文件,并让SWIG为我的主.cpp文件生成包装.cpp文件.我已经设置了我的代码来构建扩展名为.pyd的.dll.
这是我目前的.i文件:
%module HiveGPS
%{
#include "ou_thread.h"
#include "HiveGPS.h"
%}
%include ou_thread.h
%include HiveGPS.h
Run Code Online (Sandbox Code Playgroud)
我已经漫画来获取.py和.pyc文件.现在,根据我的理解,为了运行我的.py文件,我需要将它链接到我的.pyd文件,但是当我尝试使用VS2010使用上面列出的设置构建我的项目时,它会抱怨Thread类我使用:
1>------ Build started: Project: HiveGPS, Configuration: Release Win32 ------
1>Build started 5/11/2011 1:41:30 PM.
1>InitializeBuildStatus:
1> Touching "Release\HiveGPS.unsuccessfulbuild".
1>ClCompile:
1> HiveGPS_wrap.cpp
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C2146: syntax error : missing ';' before identifier 'm_strName'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(64): error …Run Code Online (Sandbox Code Playgroud) 我目前正在运行g++版本4.3.4,当我运行以下命令时:
g ++ -g -Wall test.cpp -o test.exe
对此:
#include<stdlib.h>
#include<iostream>
using namespace std;
int main (){
cout << "Hello World!";
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
似乎没有发生任何事情:Cygwin似乎滞后片刻,但没有exe创建(如果cpp源中有错误,则显示它们)
和想法?
我正在尝试使用此表单在我的文件中读取:
<form name="UploadForm" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a CSV file to upload: <input name="upload_file" type="file" /><br />
<input type="submit" value="Upload" onClick="uploadFile()" />
</form>
Run Code Online (Sandbox Code Playgroud)
但当我去读取此函数中的值时,我收到一个"cannon find"元素"null null:
function uploadFile() {
var file = document.getElementById('UploadForm').elements['upload_file'].value;
var allTextLines = file.split(/\r\n|\n/);
var headers = allTextLines[0].split(',');
var lines = [];
for (var i=1; i<allTextLines.length; i++) {
var data = allTextLines[i].split(',');
if (data.length == headers.length) {
var tarr = [];
for (var j=0; j<headers.length; j++) {
tarr.push(headers[j]+":"+data[j]);
}
lines.push(tarr);
}
}
alert(lines);
}; …Run Code Online (Sandbox Code Playgroud)