搭建eclipse下的c和c++开发环境
我们需要一个cdt,这个可以在Eclipse官网下载。
我们需要MinGW——C/C++编译平台,下载后需要安装,同时选中g++、MinGW Make,同时设置环境变量,将%MinGW_HOME%\bin设置到PATH中,然后我们可以通过命令行敲击gcc,看是否有效果。
我们需要gdb——C/C++调试平台,下载后安装,默认到MinGW_HOME就行。
我们开启eclipse编译一个C/C++工程,右键可以运行,调试。
一直都想在Eclipse下搭建一个C/C++的开发平台,却一直未能如愿。最近,终于成功了,其实很简单。
安装
设置环境变量
新建C项目
新建C++项目
来段HelloWorld
C的
C代码
#include ﹤stdio.h>
#include ﹤stdlib.h>
int main(void) {
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
控制台编译输出
Console代码
**** Build of configuration Debug for project c ****
**** Internal Builder is used for build ****
gcc -O0 -g3 -Wall -c -fmessage-length=0 -osrc\c.o ..\src\c.c
gcc -oc.exe src\c.o
Build complete for project c
Time consumed: 14011 ms.
控制台结果输出
Console代码
!!!Hello World!!!
C++的
C++代码
#include ﹤iostream>
using namespace std;
int main() {
cout ﹤﹤ "!!!Hello World!!!" ﹤﹤ endl; // prints !!!Hello World!!!
return 0;
}
控制台编译输出
Console代码
**** Build of configuration Debug for project cpp ****
**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\cpp.o ..\src\cpp.cpp
g++ -ocpp.exe src\cpp.o
Build complete for project cpp
Time consumed: 25452 ms.
控制台结果输出
Console代码
!!!Hello World!!!
相关文档:
http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......
http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/mexfunction.html
mexFunction (C and Fortran) -
Entry point to C/C++ or Fortran MEX-file
C Syntax
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);
Fortran
Syntax
subrouti ......
1,栈区(stack)— 由编译器自动分配释放,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。 例如,声明在函数中的一个局部变量int b;系统自动在栈中为b开辟空间。只要栈的剩余空间大于所申请空间,系统将为程序提供内存,否则将报异常提示栈溢出。比如:
char* AllocStrfromStack ......
作者:宋宝华 e-mail:21cnbao@21cn.com
1. 引言
指针是C/C++语言的特色,而数组名与指针有太多的相似,甚至很多时候,数组名可以作为指针使用。于是乎,很多程序设计者就被搞糊涂了。而许多的大学老师,他们在C语言的教学过程中也错误得给学生讲解:“数组名就是指针”。很幸运,我的大学老 ......