易截截图软件、单文件、免安装、纯绿色、仅160KB

一个C++调用C的例子

//cExample.h
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x, int y);
#ifdef __cplusplus
}
#endif
#endif
---------------------------------
//cExample.c
#include"cExample.h"
int add(int x, int y)
{
 return x + y;
}
---------------------------------
//cppFile.cpp
#include <iostream>
#include"cExample.h"
using namespace std;
main()
{
    cout<<add(2,3)<<endl;
    return 0;
}
--------------------------------
//makefile
cppFile: cppFile.o cExample.o
    g++ -g -o cppFile cppFile.o cExample.o
cppFile.o: cppFile.cpp
    g++ -g -c cppFile.cpp
cExample.o: cExample.c cExample.h
    gcc -g -c cExample.c
clean:
    rm -f *.o cppFile


相关文档:

c sharp 无法调用dll

原来是被调用的dll又调用了其他的dll
第二个dll忘记了考到工作目录下
导致了c sharp一直没能加载dll。报错:找不到dll
现在想起来,所谓的dll找不到,应该是找不到第二个dll
消耗时间2个小时,心情稍微有点受影响 ......

使用VMware构建快采调试环境(C/S结构)

操作步骤:
1.物理机安装VMWare,在虚拟机中安装Windows XP Professional + SP2
2.VM->Install VMware Tools...
3.在VMware主界面双击Ethernet,并选定Host-only选项
4.在物理机网络连接中,设置VMware Network Adapter VMnet1的IP地址为:130.0.0.50,子网掩码:255.255.0.0,其余为空,作为操作站使用。同时禁用VM ......

好神奇的 extern "C" 哦。。。

有关 extern "C"

搞过C和C++混编的同志们都知道这个啥意思。
这儿有讲:http://www.cppblog.com/Macaulish/archive/2008/06/17/53689.html

但看一下下面的这个代码:

#include <iostream>
using namespace
std;

extern "C" { int g_inta; }

int main (void)
{
g_ ......

C/C++/VC MFC char & int study

测试代码一(VC6.0、C-code):
#include <stdio.h>
void main()
{
 int aa;
 unsigned char j1,j2;
 aa=j1=j2=0;
 aa=49;
 j1=aa;
 printf("j1=%d \n",j1);
 j2=aa;
 printf("j2=%c \n",j2);
}
【分析】:
[1]正如所想象的输出结果:
    j1 ......

C/C++面试题


1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx
++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&l ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号