Ò»¸ö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
Ïà¹ØÎĵµ£º
LinuxϽøÐÐMYSQLµÄC++±à³ÌÆð²½ÊÖ¼Ç
Ê×ÏȰ²×°±ØÐèµÄ¿ª·¢°ü
sudo apt-get install gcc g++ libgcc1 libg++ make gdb
°²×°MYSQLµÄCÓïÑÔ¿ª·¢°ü
sudo apt-get install libmysql++-dev libmysql++2c2a libmysqlclient15-dev libmysqlclient15off
......
ʹÓÃNDK¿ª·¢C/C++ÏîÄ¿¹æÔò
<!-- /* Font Definitions */ @font-face {font-family:ËÎÌå; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;}@font-face {font-family:"\@ËÎÌå&qu ......
´æ´¢Àà¾ÍÊÇÓÃÓÚ´æ´¢³ÌÐòÊý¾ÝµÄÄÚ´æµÄÀàÐÍ£¬ÓÉÈý¸öÊôÐÔÀ´±íʾ£º´æ´¢Ê±¼ä¡¢×÷ÓÃÓòºÍÁ´½Ó¡£
´æ´¢Ê±ÆÚÃèÊöµÄÊDZäÁ¿Õ¼ÓÃÄÚ´æµÄʱ¼ä£¬Óо²Ì¬µÄ¡¢×Ô¶¯µÄºÍ·ÖÅäµÄÈýÖÖ
×÷ÓÃÓòÊDZäÁ¿Æðµ½×÷Óõķ¶Î§£¬ÓдúÂë¿é×÷ÓÃÓòºÍÎļþ×÷ÓÃÓòÁ½ÖÖ
Á´½Ó˵Ã÷¸Ã±äÁ¿¿ÉÒÔ±»ÄÄЩµØ·½ÒýÓã¬ÓпÕÁ´½Ó¡¢ÄÚ²¿Á´½ÓºÍÍⲿÁ´½ÓÈýÖÖ
ÏÂÃæÊÇÎåÖÖ´æ´¢ÀàµÄÊôÐÔ ......
.¸ÅÂÛ
¡¡¡¡ÔËÐÐʱ¿âÊdzÌÐòÔÚÔËÐÐʱËùÐèÒªµÄ¿âÎļþ£¬Í¨³£ÔËÐÐʱ¿âÊÇÒÔLIB»òDLLÐÎʽÌṩµÄ¡£
CÔËÐÐʱ¿âµ®ÉúÓÚ20ÊÀ¼Í70Äê´ú£¬µ±Ê±µÄ³ÌÐòÊÀ½ç»¹ºÜµ¥´¿£¬Ó¦ÓóÌÐò¶¼Êǵ¥Ï̵߳쬶àÈÎÎñ»ò¶àÏ̻߳úÖÆÔÚ´Ëʱ»¹ÊôÓÚйÛÄî¡£ËùÒÔÕâ¸öʱÆÚµÄCÔËÐÐʱ¿â¶¼Êǵ¥Ï̵߳ġ£
¡¡¡¡Ëæ×ŲÙ×÷ϵͳ¶àÏ̼߳¼ÊõµÄ·¢Õ¹£¬×î³õµÄCÔ ......