Skip to content

Commit

Permalink
优化Windows下编译
Browse files Browse the repository at this point in the history
  • Loading branch information
HEYAHONG committed Jan 10, 2025
1 parent eea00c7 commit c97b65f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
17 changes: 17 additions & 0 deletions hbox/hdefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ extern "C"
#endif // WIN32
#endif // __CYGWIN__

//提高windows下的兼容性
#ifdef _WIN32
#ifndef WIN32
#define WIN32 1
#endif // WIN32
#endif // _WIN32
#ifdef __WIN32
#ifndef WIN32
#define WIN32 1
#endif // WIN32
#endif // __WIN32
#ifdef __WIN32__
#ifndef WIN32
#define WIN32 1
#endif // WIN32
#endif // __WIN32__

//定义操作系统
#ifdef __RTTHREAD__
#include "hdefaults/hdefaults_os_rtthread.h"
Expand Down
1 change: 1 addition & 0 deletions hbox/hdefaults/hdefaults_os_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef __HDEFAULTS_OS_WINDOWS_H__
#define __HDEFAULTS_OS_WINDOWS_H__
#include "hdefaults_common.h"
#include "winsock2.h"
#include "windows.h"


Expand Down
1 change: 1 addition & 0 deletions hcppbox/HCPPBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef HCPPBOX_H_INCLUDED
#define HCPPBOX_H_INCLUDED

#include "hbox.h"
#include "HCPPObject.h"
#include "HCPPObjectPool.h"
#include "HCPPThread.h"
Expand Down
1 change: 1 addition & 0 deletions hcppbox/HCPPGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
**************************************************************/
#ifndef __HCPPGUI_H__
#define __HCPPGUI_H__
#include "hbox.h"

#ifdef __cplusplus
extern "C"
Expand Down
2 changes: 1 addition & 1 deletion hcppbox/HCPPSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
**************************************************************/
#ifndef __HCPPSOCKET_H__
#define __HCPPSOCKET_H__

#include "hbox.h"
#if defined(__unix__) || defined(__linux__)
#ifndef HCPPSOCKET_HAVE_SOCKET
#define HCPPSOCKET_HAVE_SOCKET 1
Expand Down
4 changes: 1 addition & 3 deletions test/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ print("Tools={}".format(env["TOOLS"]))
if "msvc" in env["TOOLS"]:
env.AppendUnique(CFLAGS='/utf-8')
env.AppendUnique(CFLAGS='/std:clatest')
env.AppendUnique(CFLAGS='/DWIN32=1')
env.AppendUnique(CXXFLAGS='/utf-8')
env.AppendUnique(CXXFLAGS='/std:c++latest')
env.AppendUnique(CXXFLAGS='/DWIN32=1')
env.AppendUnique(CXXFLAGS='/utf-8')
env.AppendUnique(LIBS=['kernel32.lib','user32.lib','gdi32.lib','winspool.lib','shell32.lib','ole32.lib','oleaut32.lib','uuid.lib','comdlg32.lib','advapi32.lib'])

#gcc设置
Expand Down

0 comments on commit c97b65f

Please sign in to comment.