在x86系列PC中,linux和windows可执行文件只是文件格式的不同:
windows使用PE格式
linux使用ELF格式
所以理论上,只要你有一个可以编译你的C代码的人ELFC编译器的文件格式。但在实际使用中,您可能需要使用大量的系统库文件,它们也必须是ELF格式。
所以NI提供了一个cvicc当你在的时候,编译工具windows开发完成后,代码可以复制到linux主机上用这个工具编译即可。
--------------------------------------------------------------------------------
Q: How do I build and run my LabWindows/CVI project?
Once you have developed and sufficiently tested your application on Windows, you must copy your project, including source files, to a Linux machine. You then recompile your files on Linux. Use the cvicc command to build a LabWindows/CVI project or compile a source file.
The following commands are available:
Command
Action
cvicc
Shows the command syntax. Adding -help and -? also displays the command syntax.
cvicc project.prj
Builds the release target of project.prj.
cvicc project.prj project2.prj
Builds the release targets of project.prj and project2.prj.
cvicc file.c
Compiles file.c with default build options.
cvicc file.c file2.c
Compiles file.c and file2.c with default build options.
cvicc file.c project.prj
Compiles file.c with build options you set for project.prj. file.c does not need to be included in project.prj. project.prj is not built.
cvicc file.c file2.c project.prj
Compiles file.c and file2.c with build options you set for project.prj. The source files do not need to be included in project.prj. project.prj is not built.
You can pass any number of source files to be compiled at one time. You can pass any number of projects to be built at one time. If you specify any number of source files, you can specify only one project file.
The compiler returns 0 if all targets are created successfully. If there is any error creating the target, or the build could not start, the compiler returns -1.
The following additional arguments are available:
Command
Action
-debug
Creates the debuggable version of the target. This argument applies only for building projects.
-rebuild
Forces LabWindows/CVI to recompile all source files you specify and all source files in projects you specify.
-log logfile
Copies all build output to the logfile you specify.
/DDEFINE
Adds more compiler defines to any compiler defines that are set in the project. You can specify multiple defines.
-l library
Indicates that the specified library is required by the project.
/I path
Adds the specific path to the list of locations that cvicc uses to search include files.
For more information about the cvicc command, refer to the Building a Linux Application help topic.