| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1827 人关注过本帖
标题:[求助]这是C,还是C++源代码啊?
只看楼主 加入收藏
seankent
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-3-11
收藏
得分:0 

--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
c:\program files\microsoft visual studio\vc98\include\winsock2.h(99) : error C2011: 'fd_set' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(134) : warning C4005: 'FD_SET' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(83) : see previous definition of 'FD_SET'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(143) : error C2011: 'timeval' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(199) : error C2011: 'hostent' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(212) : error C2011: 'netent' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(219) : error C2011: 'servent' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(226) : error C2011: 'protoent' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(310) : error C2011: 'in_addr' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(368) : error C2011: 'sockaddr_in' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(378) : error C2011: 'WSAData' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(430) : warning C4005: 'SO_DONTLINGER' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(391) : see previous definition of 'SO_DONTLINGER'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(483) : warning C4005: 'AF_IPX' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(449) : see previous definition of 'AF_IPX'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(506) : warning C4005: 'AF_MAX' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(468) : see previous definition of 'AF_MAX'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(512) : error C2011: 'sockaddr' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(521) : error C2011: 'sockproto' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(560) : error C2011: 'linger' : 'struct' type redefinition
c:\program files\microsoft visual studio\vc98\include\winsock2.h(573) : warning C4005: 'SOMAXCONN' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(533) : see previous definition of 'SOMAXCONN'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(598) : warning C4005: 'FD_READ' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(551) : see previous definition of 'FD_READ'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(601) : warning C4005: 'FD_WRITE' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(552) : see previous definition of 'FD_WRITE'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(604) : warning C4005: 'FD_OOB' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(553) : see previous definition of 'FD_OOB'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(607) : warning C4005: 'FD_ACCEPT' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(554) : see previous definition of 'FD_ACCEPT'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(610) : warning C4005: 'FD_CONNECT' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(555) : see previous definition of 'FD_CONNECT'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(613) : warning C4005: 'FD_CLOSE' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\winsock.h(556) : see previous definition of 'FD_CLOSE'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1427) : error C2375: 'accept' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(707) : see declaration of 'accept'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1448) : error C2375: 'bind' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(710) : see declaration of 'bind'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1467) : error C2375: 'closesocket' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(712) : see declaration of 'closesocket'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1486) : error C2375: 'connect' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(714) : see declaration of 'connect'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1507) : error C2375: 'ioctlsocket' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(716) : see declaration of 'ioctlsocket'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1528) : error C2375: 'getpeername' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(718) : see declaration of 'getpeername'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1549) : error C2375: 'getsockname' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(721) : see declaration of 'getsockname'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1572) : error C2375: 'getsockopt' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(724) : see declaration of 'getsockopt'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1593) : error C2375: 'htonl' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(727) : see declaration of 'htonl'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1610) : error C2375: 'htons' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(729) : see declaration of 'htons'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1627) : error C2375: 'inet_addr' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(731) : see declaration of 'inet_addr'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1644) : error C2375: 'inet_ntoa' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(733) : see declaration of 'inet_ntoa'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1662) : error C2375: 'listen' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(735) : see declaration of 'listen'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1680) : error C2375: 'ntohl' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(737) : see declaration of 'ntohl'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1697) : error C2375: 'ntohs' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(739) : see declaration of 'ntohs'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1717) : error C2375: 'recv' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(741) : see declaration of 'recv'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1742) : error C2375: 'recvfrom' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(743) : see declaration of 'recvfrom'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1768) : error C2375: 'select' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(746) : see declaration of 'select'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1792) : error C2375: 'send' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(749) : see declaration of 'send'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1817) : error C2375: 'sendto' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(751) : see declaration of 'sendto'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1843) : error C2375: 'setsockopt' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(754) : see declaration of 'setsockopt'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1865) : error C2375: 'shutdown' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(757) : see declaration of 'shutdown'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1885) : error C2375: 'socket' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(759) : see declaration of 'socket'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1908) : error C2375: 'gethostbyaddr' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(763) : see declaration of 'gethostbyaddr'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1927) : error C2375: 'gethostbyname' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(766) : see declaration of 'gethostbyname'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1945) : error C2375: 'gethostname' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(768) : see declaration of 'gethostname'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1964) : error C2375: 'getservbyport' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(770) : see declaration of 'getservbyport'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(1983) : error C2375: 'getservbyname' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(772) : see declaration of 'getservbyname'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2001) : error C2375: 'getprotobynumber' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(775) : see declaration of 'getprotobynumber'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2018) : error C2375: 'getprotobyname' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(777) : see declaration of 'getprotobyname'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2038) : error C2375: 'WSAStartup' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(781) : see declaration of 'WSAStartup'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2056) : error C2375: 'WSACleanup' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(783) : see declaration of 'WSACleanup'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2073) : error C2375: 'WSASetLastError' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(785) : see declaration of 'WSASetLastError'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2090) : error C2375: 'WSAGetLastError' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(787) : see declaration of 'WSAGetLastError'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2107) : error C2375: 'WSAIsBlocking' : redefinition; different linkage
c:\program files\microsoft visual studio\vc98\include\winsock.h(789) : see declaration of 'WSAIsBlocking'
c:\program files\microsoft visual studio\vc98\include\winsock2.h(2124) : error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage

Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

Cpp1.exe - 98 error(s), 11 warning(s)

2006-03-11 13:42
nlf11119
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-3-1
收藏
得分:0 

我是个新手 有谁能教教我 运行出来的答案用什么办法可以打印出来

2006-03-11 19:12
sunnvya
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:1094
专家分:0
注 册:2005-11-23
收藏
得分:0 
C++啊
网络编程啊

http://www. 第二站>>>提供源码下载
2006-03-11 21:35
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
原代码有几处错,可能是作者故意为之
long ret1=(::RegQueryvalueEx(hKEY,"Dll_Hostm", 0,&dwType, username_Get,&cbData_1));
if(ret1!=ERROR_SUCCESS)
{
DWORD setsize;
setsize=strlen(szExecFile)+1;
dwType=REG_SZ;
//与RegQureyvalueEx()类似, hKEY表示已打开的键的句柄,"DefName"表示要访问的键值名,username_Set 表示新的键值,type_1和setsize表示新值的数据类型和数据长度
long ret9=::RegSetvalueEx(hKEY,"Dll_Hostm", 0, dwType, (const unsigned char*) szExecFile, setsize);
if(ret9!=ERROR_SUCCESS) { //printf("错误: 无法修改有关注册表信息!");
return(false); }
}
sprintf(szIP[i],"NO %d IP Address : %s\n",i+1,psz);

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2006-03-11 22:24
high20033763
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2006-2-13
收藏
得分:0 
楼上实在是强,
2006-03-13 20:09
西部天狼
Rank: 1
等 级:新手上路
帖 子:95
专家分:0
注 册:2006-2-23
收藏
得分:0 
以下是引用wanglff在2006-3-11 9:38:00的发言:

c源代码
#include "stdafx.h"
#include "Afxwin.h"
#include <stdlib.h>
#include <stdio.h>//在c++中#include <cstdio.h>
#include <conio.h>
#include <afx.h> //CString
#include <winsock2.h>
#include <process.h>
#include <Shellapi.h>
看这些就知道了

大哥,不是我故意跟你做对,你发帖子确实欠考虑啊
C是C++的一个子集,所以 自从C++出现后,就不应该说什么C还是C++代码了,只能说是C++代码了。
如果加一个区分,那就看这里有没有面向对象的成份。
注意#include "stdafx.h"
#include "Afxwin.h"

#include <afx.h>
就看这三个头文件,可都是MFC的啊,MFC可以有面向对象的特征啊,所以 怎么也不能说是C代码啊
发贴前一定要好好考虑问题,这样对自己也是个煅练


学习-->编程-->交流-->再学习-->再编程-->再交流
2006-03-14 16:13
快速回复:[求助]这是C,还是C++源代码啊?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021178 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved