如何编译一段代码而不编译整个代码 [英] How to compile a piece of code without compile the whole code

查看:139
本文介绍了如何编译一段代码而不编译整个代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这是一款带有铝条臂和螺杆末端的模型。螺旋桨由电机控制,以便臂可以上下移动。该型号还有另一个功能,即通过串口连接电脑。



我在visual c / c ++和openGL中创建了该模型的接口。它具有测量角度(θ),螺旋桨推力以及与实际系统相对应的角度与推力等相应图形等特征。



到目前为止,所有功能都运行良好。



现在我的问题是控制器部分。由于控制器有两个部分 - 一部分用于PC,另一部分用于微控制器板。



现在我想让pc部分的控制器变得动态。让我们说,我运行整个程序。它给出了期望的结果。

但我想制作一个小gui,我可以为控制器(用于pc部分)编写一小段代码(在C中),然后我只编译那个小部分该程序不是整个系统。



有可能吗?



任何想法.. !! !

型号 -



http://www.flickr.com/photos/95493415@N04/8709126378/in/photostream [ ^ ]

谢谢。

Hi,

Here is a model that has an arm of aluminum bar and a propeller at the end of bar. The propeller is controlled by a motor so that the arm can moves up and down.The model has another feature that to connect with the pc via serial port.

I have created an Interface of that model in visual c/c++ and openGL. It has the features like measuring the angle(theta), propeller thrust and some corresponding graph as angle vs thrust etc. corresponding the actual system.

So far,all the features are working well.

Now my question is for the controller part. As the controller has two parts-- one part is for PC and the other is for the micro controller board.

Now I want to make the controller for pc part as dynamic. Lets say, I run the whole program. It gives the desired result.
But I want to make a small gui where I can write a small piece of code(in C) for controller(for pc part) and then I only compile that small part of the program not the whole system.

Is it possible?

Any Idea..!!!
The model--

http://www.flickr.com/photos/95493415@N04/8709126378/in/photostream[^]
Thanks.

推荐答案

当然,你需要编译所有东西,而不是代码的一部分来运行应用程序。



即使生成不同的源代码,编译(你需要携带一个编译器和一个链接器与你的运行时)它和执行是可能的,并在一些(非常先进和不寻常)使用应用程序,这是一个非常糟糕的主意,它不会使系统更加动态。这个想法是基于对非常基本的编程范式的深刻误解。在构建和部署代码时,不要使用它来部署开发工具。不幸的是,这个名为Quick Questions& Answers的论坛不适合教授范式和编程基础知识。我认为你需要在编程方面接受认真的教育就足够了。



-SA
Certainly, you need to compile everything, not a part of the code, to run the application.

Even though generating different source code, compiling (you would need to carry a compiler and a linker with your runtime) it and executing is possible and is used in some (quite advanced and unusual) applications, this is a really bad idea, and it does not make the system more "dynamic" as it can be. This idea is based on deep misunderstanding of the very basic programming paradigms. When you build and deploy the code, you don''t deploy the development tools with it. Unfortunately, this forum named "Quick Questions & Answers" is not a right place for teaching paradigms and basics of programming. I think it would be enough to say that you need to get serious education in programming.

—SA

Microsoft提供了一种可用于此COM的机制。使用此(过时)技术,您可以定义一组接口,编写实现所有接口的原始COM对象以及使用此对象的客户端代码。您可以稍后更新您的对象或编写一个新对象,您现有的代码可以使用它而无需重新编译。



更多等等等等的COM可以找到在其中 [ ^ ]。



可以找到一些编程示例这里 [ ^ ]。



...或询问Google。
Microsoft has provided a mechanism you can use for this called "COM". Using this (obsolete) technology, you define a set of interfaces, write an original COM object that implements all of the interfaces, and the client code that uses this object. You can later update your object or write a new one, which your existing code can use without recompilation.

More blah blah blah on COM can be found here[^].

Some programming examples can be found here[^].

... or ask Google.


通常,如果你想支持类似的东西,你将为你的应用程序添加一些脚本(宏)语言支持...



或者你的应用程序可以支持一些插件架构。但是你不会将这个方向用于一般用户(而不是开发人员)的典型应用程序。



我认为你的解析是一种宏语言如果您想向控制器发出命令,例如向左移动50度,向上移动10度,则从您的代码可能是合适的。



但是如果目标听众是普通用户,那么迁移最好有一个前端UI,用户可以从列表中选择项目并以连接模式(硬件设备移动)或预览模式执行它们(您只更新表示在屏幕上。)
Usually if you want to support something like that you will add some scripting (macro) language support to your application...

Or your application can support some plugins architechture. But you won''t use that direction for a typical application that is intented for general users (and not developpers).

I think that a macro language that your parse from your code might be appropriate in your case if you want to give orders to the controller like move left 50 degrees, move up 10 degrees...

But if the target audiance is general user, then it migth be better to have a front-end UI where the user can pick items from a list and execute them either in connected mode (the hardware device move) or in preview mode (you only update the representation on screen).


这篇关于如何编译一段代码而不编译整个代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆