我想在项目中包含vdb(github.com/mmp/pbrt-v2)
我尝试过vdb的例子,每个例子都可以。
但是在这个项目(pbrt)中,我遇到了错误identifier not found
这是我的代码:
#include "../vdb.h"
#include "stdafx.h"
#include "shapes/heightfieldImproved.h"
#include "shapes/trianglemesh.h"
#include "paramset.h"
// heightfieldImproved Method Definitions
HeightfieldImproved::HeightfieldImproved(const Transform *o2w, const Transform *w2o, bool ro, int x, int y, const float *zs)
: Shape(o2w, w2o, ro) {
nx = x;
ny = y;
z = new float[nx*ny];
memcpy(z, zs, nx*ny*sizeof(float));
nVoxels[0] = nx - 1;
nVoxels[1] = ny - 1;
nVoxels[2] = 1;
ComputeVertexNormal();
vdb_line(0, 0, 0, 1, 1, 1);
}
IntelliSense工作正常,它知道vdb_line()
是什么,但是当我构建整个项目时,引发的错误("vdb_line": identifier not found
)
我在win10上使用visual studio 2015
谢谢!
---编辑---
我将include更改为完整路径
#include "C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h"
仍然得到同样的错误.... 只有一个错误:
"vdb_line": identifier not found
完整日志
1>------ Build started: Project: libpbrt, Configuration: Debug x64 ------
1>
1> Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> if exist ( -d -v -t -o ..\core\pbrtparse.cpp ..\core\pbrtparse.yy )
1> if exist ( -o..\core\pbrtlex.cpp ..\core\pbrtlex.ll )
1>
1> Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> heightfieldImproved.cpp
1>..\shapes\heightfieldImproved.cpp(25): error C3861: 'vdb_line': identifier not found
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
---编辑2 --- 在我更改include的顺序后,如下所示:
#include "stdafx.h"
#include "C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h"
我收到很多错误:
1>------ Build started: Project: libpbrt, Configuration: Debug x64 ------
1>
1> Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> if exist ( -d -v -t -o ..\core\pbrtparse.cpp ..\core\pbrtparse.yy )
1> if exist ( -o..\core\pbrtlex.cpp ..\core\pbrtlex.ll )
1>
1> Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> heightfieldImproved.cpp
1>C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(221): error C2011: 'sockaddr' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(477) : see declaration of 'sockaddr'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(421): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(421): error C3805: 'constant': unexpected token, expected either '}' or a ','
1>C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(615): error C2011: 'sockaddr_in' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(304) : see declaration of 'sockaddr_in'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(136): error C2011: 'fd_set' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(60) : see declaration of 'fd_set'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(180): error C2011: 'timeval' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(103) : see declaration of 'timeval'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(236): error C2011: 'hostent' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(159) : see declaration of 'hostent'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(249): error C2011: 'netent' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(172) : see declaration of 'netent'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(256): error C2011: 'servent' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(179) : see declaration of 'servent'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(268): error C2011: 'protoent' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(191) : see declaration of 'protoent'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(364): error C2011: 'WSAData' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(314) : see declaration of 'WSAData'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(462): error C2011: 'sockproto' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(486) : see declaration of 'sockproto'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(504): error C2011: 'linger' : 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(523) : see declaration of 'linger'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1650): error C2375: 'accept' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(734) : see declaration of 'accept'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1672): error C2375: 'bind' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(739) : see declaration of 'bind'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1691): error C2375: 'closesocket' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(744) : see declaration of 'closesocket'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1710): error C2375: 'connect' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(746) : see declaration of 'connect'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1731): error C2375: 'ioctlsocket' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(751) : see declaration of 'ioctlsocket'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1752): error C2375: 'getpeername' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(756) : see declaration of 'getpeername'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1773): error C2375: 'getsockname' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(761) : see declaration of 'getsockname'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1796): error C2375: 'getsockopt' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(766) : see declaration of 'getsockopt'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1817): error C2375: 'htonl' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(773) : see declaration of 'htonl'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1834): error C2375: 'htons' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(775) : see declaration of 'htons'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1852): error C2375: 'inet_addr' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(777) : see declaration of 'inet_addr'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1870): error C2375: 'inet_ntoa' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(779) : see declaration of 'inet_ntoa'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1971): error C2375: 'listen' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(781) : see declaration of 'listen'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(1989): error C2375: 'ntohl' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(785) : see declaration of 'ntohl'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2006): error C2375: 'ntohs' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(787) : see declaration of 'ntohs'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2026): error C2375: 'recv' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(789) : see declaration of 'recv'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2051): error C2375: 'recvfrom' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(795) : see declaration of 'recvfrom'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2077): error C2375: 'select' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(803) : see declaration of 'select'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2101): error C2375: 'send' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(810) : see declaration of 'send'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2126): error C2375: 'sendto' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(816) : see declaration of 'sendto'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2152): error C2375: 'setsockopt' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(824) : see declaration of 'setsockopt'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2174): error C2375: 'shutdown' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(831) : see declaration of 'shutdown'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2195): error C2375: 'socket' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(835) : see declaration of 'socket'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2220): error C2375: 'gethostbyaddr' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(842) : see declaration of 'gethostbyaddr'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2240): error C2375: 'gethostbyname' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(847) : see declaration of 'gethostbyname'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2258): error C2375: 'gethostname' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(849) : see declaration of 'gethostname'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2298): error C2375: 'getservbyport' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(853) : see declaration of 'getservbyport'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2317): error C2375: 'getservbyname' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(857) : see declaration of 'getservbyname'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2335): error C2375: 'getprotobynumber' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(861) : see declaration of 'getprotobynumber'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2352): error C2375: 'getprotobyname' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(863) : see declaration of 'getprotobyname'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2373): error C2375: 'WSAStartup' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(867) : see declaration of 'WSAStartup'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2392): error C2375: 'WSACleanup' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(871) : see declaration of 'WSACleanup'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2409): error C2375: 'WSASetLastError' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(873) : see declaration of 'WSASetLastError'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2426): error C2375: 'WSAGetLastError' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(875) : see declaration of 'WSAGetLastError'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2447): error C2375: 'WSAIsBlocking' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(877) : see declaration of 'WSAIsBlocking'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2465): error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(879) : see declaration of 'WSAUnhookBlockingHook'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2483): error C2375: 'WSASetBlockingHook' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(881) : see declaration of 'WSASetBlockingHook'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2501): error C2375: 'WSACancelBlockingCall' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(883) : see declaration of 'WSACancelBlockingCall'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2524): error C2375: 'WSAAsyncGetServByName' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(885) : see declaration of 'WSAAsyncGetServByName'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2552): error C2375: 'WSAAsyncGetServByPort' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(893) : see declaration of 'WSAAsyncGetServByPort'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2579): error C2375: 'WSAAsyncGetProtoByName' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(901) : see declaration of 'WSAAsyncGetProtoByName'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2605): error C2375: 'WSAAsyncGetProtoByNumber' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(908) : see declaration of 'WSAAsyncGetProtoByNumber'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2631): error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(915) : see declaration of 'WSAAsyncGetHostByName'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2659): error C2375: 'WSAAsyncGetHostByAddr' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(922) : see declaration of 'WSAAsyncGetHostByAddr'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2683): error C2375: 'WSACancelAsyncRequest' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(931) : see declaration of 'WSACancelAsyncRequest'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\WinSock2.h(2704): error C2375: 'WSAAsyncSelect' : redefinition; different linkage
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(933) : see declaration of 'WSAAsyncSelect'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(60): error C3861: 'closesocket': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(102): error C2568: '=' : unable to resolve function overload
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(835): could be 'SOCKET socket(int,int,int)'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(102): error C3861: 'socket': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(107): error C2079: 'serv_name' uses undefined struct 'sockaddr_in'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(108): error C2228: left of '.sin_family' must have class/struct/union
1> type is 'int'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(109): error C2228: left of '.sin_addr' must have class/struct/union
1> type is 'int'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(109): error C2228: left of '.S_un' must have class/struct/union
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(109): error C2228: left of '.S_addr' must have class/struct/union
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(109): error C3861: 'htonl': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(110): error C2228: left of '.sin_port' must have class/struct/union
1> type is 'int'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(110): error C3861: 'htons': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(111): error C2568: '==' : unable to resolve function overload
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(746): could be 'int connect(SOCKET,const sockaddr *,int)'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(111): error C3861: 'connect': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(126): error C2568: '=' : unable to resolve function overload
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(810): could be 'int send(SOCKET,const char *,int,int)'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(126): error C3861: 'send': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(215): error C3861: 'WSAGetLastError': identifier not found
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(215): error C2440: 'initializing' : cannot convert from 'int (__cdecl *)(void)' to 'int'
1> There is no context in which this conversion is possible
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(229): error C2079: 'wsaData' uses undefined struct 'WSAData'
1>C:\Users\ssarcandy\Documents\GitHub\pbrt-v2\src\vdb.h(230): error C3861: 'WSAStartup': identifier not found
2>------ Build started: Project: pbrt, Configuration: Debug x64 ------
2>LINK : fatal error LNK1104: cannot open file 'libpbrt.lib'
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
答案 0 :(得分:1)
包含vdb.h
的正确位置是stdafx.h
之后,而不是之前。默认情况下,如果您的项目设置为使用预编译头,它将忽略源文件中stdafx.h
之前的所有包含。你应该在你在帖子中提到的错误之前看到一个告诉你的警告:
warning C4627: '#include "vdb.h"': skipped when looking for precompiled header use
note: Add directive to 'StdAfx.h' or rebuild precompiled header
这是后来编辑失败的方式告诉你它无法找到该功能。
现在,如果在stdafx.h
之后移动include语句,则会出现很多错误,其中大部分都是关于WinSock相关名称的重复定义。
那是因为您最终同时包含winsock.h
和WinSock2.h
。第一个包含在windows.h
中,后者又包含在以stdafx.h
开头并以parallel.h
结尾的长链中。第二个直接包含在vdb.h
。
要解决这个问题,你可以通过两种方式解决这个问题:
<强> 1。让windows.h
不自动包含winsock.h
为此,在任何其他包含语句之前,在stdafx.h
的顶部定义宏WIN32_LEAN_AND_MEAN。
#define WIN32_LEAN_AND_MEAN
这会禁用除winsock.h
之外的其他几个标题,因此您在执行此操作时可能会遇到一些新错误。您可以尝试通过在需要的地方直接包含相应的标题来解决这些问题。
我不熟悉PBRT项目及其源代码,我不知道它是否真的使用了WinSock,或者它只是在没有实现的情况下包含了标题,所以我无法准确地告诉你新的问题是什么可能会遇到。
<强> 2。将vdb
转换为使用winsock而不是winsock2
我对这个项目不熟悉,所以我不能告诉你这将涉及多少工作。但是初看起来,如果出于某种原因第一种方法失败,它看起来是可行的。
答案 1 :(得分:0)
编译器不知道vdb_line是什么。这条线
#include&#34; ../ vdb.h&#34;
可能不正确,因为根据你的github链接,头文件确实有 cdb_line deklaration。尝试将vdb.h与显式路径进行验证。将头文件相对于您的工作目录正确放置,以将其包含在&#34; ../ vdb.h&#34;中。
Intellisense拥有机械师。默认情况下,它仅使用标准包含目录来查找头文件。但是可以添加其他文件,甚至是非项目文件,以便解析智能感知。 intellisense知道 cdb_line 声明并且编译器不知道但为什么我们不得不查看你的visual studio项目设置并不奇怪。