Errors in Microsoft Visual C++ 2010
Apr 30, 2017 at 7:05am UTC
Hi,
I tried to include .cpp file in my project using Microsoft Visual C++ 2010 Express. I compiled in Netbeans and it works completely fine but in Visual C++ there are many errors. I also include all the headers needed. Please help me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
1>cscan.cpp(40): error C2065: 'DIR' : undeclared identifier
1>cscan.cpp(40): error C2065: 'dir' : undeclared identifier
1>cscan.cpp(41): error C2065: 'PATH_MAX' : undeclared identifier
1>cscan.cpp(41): error C2133: 'buffer' : unknown size
1>cscan.cpp(44): error C2065: 'PATH_MAX' : undeclared identifier
1>cscan.cpp(55): error C2065: 'dir' : undeclared identifier
1>cscan.cpp(55): error C3861: 'opendir' : identifier not found
1>cscan.cpp(56): error C2065: 'dir' : undeclared identifier
1>cscan.cpp(60): error C2065: 'ifstream' : undeclared identifier
1>cscan.cpp(60): error C2146: syntax error : missing ';' before identifier 'virusdb'
1>cscan.cpp(60): error C3861: 'virusdb' : identifier not found
1>cscan.cpp(61): error C2065: 'string' : undeclared identifier
1>cscan.cpp(61): error C2146: syntax error : missing ';' before identifier 'line'
1>cscan.cpp(61): error C2065: 'line' : undeclared identifier
1>cscan.cpp(62): error C2065: 'virusdb' : undeclared identifier
1>cscan.cpp(62): error C2228: left of '.is_open' must have class /struct /union
1> type is '' unknown-type''
1>cscan.cpp(64): error C2065: 'virusdb' : undeclared identifier
1>cscan.cpp(64): error C2065: 'line' : undeclared identifier
1>cscan.cpp(64): error C3861: 'getline' : identifier not found
1>cscan.cpp(65): error C2065: 'virusdb' : undeclared identifier
1>cscan.cpp(65): error C2228: left of '.close' must have class /struct /union
1> type is '' unknown-type''
1>cscan.cpp(69): error C2065: 'dir' : undeclared identifier
1>cscan.cpp(69): error C3861: 'readdir' : identifier not found
1>cscan.cpp(69): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Apr 30, 2017 at 8:40am UTC
Looks like in your cscan.cpp you miss a lot of headers. Also opendir is not a windows function.
May 3, 2017 at 3:23pm UTC
Solved!
Thanks for your response Thomas1965.
Apparently dirent.h does not included in Visual C++ because the header only found on Linux systems. I have to download from GitHub and place it in Visual C++ include directory.
Topic archived. No new replies allowed.