代码从windows下visual studio到andriod平台迁移实现步骤
代码从windows下visualstudio到andriod平台迁移实现步骤:
前言
前言也是迁言,从windows的visualstudio2012平台迁移到Android平台上,需用修改挺多的代码和需用注意地方。
我们当然的平台当初就考虑了其他平台跨平台的应用问题,所以一开始在windows下就是用cmake来完成工程的建立的,cMakeLists.txt文件都做了一些处理,但是此时只是更针对或说首先保证windows下的编译和使用。
谨此做个记录。
1.modifycMakeLists.txtfile,addandroiddefineandmacro.
2.cmake./../
Buildfileshavebeenwrittento:/home/andriod_a/build
3.size_tproblemadd<cstddef>headfile.
4.error:extraqualification'rw::scoped_lock::'onmember'scoped_lock'[-fpermissive]
removetheclassidentifier.
5.memcpydefinein<string.h>.sochangeit.
6.nomatchfor'operator='in'inverse=rw_math::matrix3f::operator*(float)const((1.0e+0f/det))'
//inverse=inverse*(1.0f/det);
matrix3ftemp=inverse*(1.0f/det);
inverse=temp;
7.nomatchfor'operator='in'rot_mat=rw_math::matrix4f::make_rotation_matrix(
matrix4fmatrix4f_tmp=make_rotation_matrix(axis_,angle_in_rad_);
rot_mat=matrix4f_tmp;
8.warning:inlinefunction'doubleconst&rw_math::vector3d::operator[](int)const'usedbutneverdefined[enabledbydefault]
9.error:'memcmp'wasnotdeclaredinthisscope
#include<string.h>
10.initializingargument2of'char*strncat(char*,charconst*,size_t)'[-fpermissive]
11.compilejpeglibrary.
copysourcecode,thenwriteorchangecMakeLists.txt,thencreateabuidfile,openterminalinthenewbuildfile.
cmake./../,thelastismake,anditwillshowu.
12.multipledefinitionof'std::__lg(int)
idefinetheinline,soerror.
13.theinlinefunctionwhichmustachieveinheadfile,andcouldnotin*.cppfile.or,ucandeleteinlinewordinheadfiles.
14.conflictswithpreviousdeclaration'typedefclassrw::rw_shared_ptr<rw_json::json_value_iterator>rw_json::json_value_iterator::ptr'
multidefine.
15.nomatchingfunctionforcallto'transform()
transform(ext_.begin(),ext_.end(),ext_.begin(),::tolower);
16.tempvaritycan'tassigntonon-constreference.
rw_shared_ptr_shadowtemp_shadow=entity_.to_shared_ptr_shadow();
pt2model_entity_define::ptrtemp_ptr=temp_shadow.to_shared_ptr<pt2model_entity_define>();
build_pt2model_entity(_pGeometry,_pSymbol,temp_ptr);
17. fatalerror:json\json.h:Nosuchfileordirector
#include<json\json.h>----->#include<json/json.h>
18. fatalerror:zlib\\zconf.h:Nosuchfileordirectory
----->#include"zlib/zlib.h"
19.error:cannotpassobjectsofnon-trivially-copyabletype'constmapped_type{akaconststructstd::basic_string<char>}'through'.
--->(content_type_field).c_str();
20.537:49:error:invalidinitializationofnon-constreferenceoftype'std::string&{akastd::basic_string<char>&}'fromanrvalueoftype'std::string{akastd::basic_string<char>}'
stringtemp_str=request_.get()->get_url();
string&tmp_req_url=temp_str;
21.error:nomatchingfunctionforcall
tempvariatyproblem.makeatempvariaty.
matrix4dtemp_mat=world_mat*t_mat;
render_system_->set_world_matrix(temp_mat);
22. abs()--->fabs();
23.rw_terrian_manager.h:69:12:error:'terrian_tile'wasnotdeclaredinthisscope
cannotrecongizethefriendclassinGCC,sochangforwarddeclaration.
#ifdef__linux__
classterrian_tile;
#endif
24.Windows.h:Nosuchfileordirectory
linuxnotcompilethismodel,andcommitit.
25. itoa---->
#include<sstream>
std::ostringstreamoss;
std::stringstr="";
oss<<_counter;
str=oss.str();
26. error:takingaddressoftemporary
box3dbbox=(instances_[i]->get_bounding());
if(!manipulate_geo_hash(instances_[i]->get_id(),&bbox,update_geo_hash))
ta
27. error:nomatchingfunctionforcallto'transform(std::basic_string<char>::iterator,std::basic_string<char>::iterator,std::basic_string<char>::iterator,<unresolvedoverloadedfunctiontype>)'
transform(_texture_type.begin(),_texture_type.end(),_texture_type.begin(),::tolower);
28. GetModuleFileName((HINSTANCE)&__ImageBase,buffer,256);
#include<stdio.h>
------->stringbuffer=getcwd(NULL,0);
stringexecution_path=buffer;
29.xstring----><string>
30.invalidcastofanrvalueexpressionoftype'rw::multi_point::ptr{akarw::rw_shared_ptr<rw::multi_point>}'totype'rw::multi_point*&'
tempvariableerror.
31. error:'atof'wasnotdeclaredinthisscope
std::stringstreamoss;
inttemp_int;
oss<<_pri_string;
oss>>temp_int;
_var=temp_int;
32.error:conflictswithpreviousdeclaration
uknown,havemorethanonedefineinu'sfile.so,findanddeleteit.
33. mallocnodeclear.
#include<malloc.h>
34. image_info_->image_type=image_type_;
rw_image:image_type("ccccccccccccccccc"),
35.don'twritelikethis.
_runtime->register_service(_aaaa_multi_service_pid,get_aaa_multi_service());
((_driver_multi_service_impl*)get_aaa_multi_service())->init(_runtime);
((_driver_multi_service_impl*)get_aaa_multi_service())->set_runtime(_runtime);
36. register_serviceatlastplacewhenadd_multi_service.
((terrian_data_sqlite_service_impl*)tms)->init();
_runtime->register_service(terrian_data_sqlite_service_pid,tms);
37. domdoesnotshow,becauseandroidsystemdoesnotsupportmulti-theradrendering.
so,puttheuploadindrawthread.
38.pleasesetRW_INDEXrw_uint16inrw_render_object_creator.cppwhenucompilethecodeinandroidsystem,otherwiseleaveitalone.
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!