score:1

Accepted answer

well, i think you should install either windows sdk 7, 8 or visual c++ 2015 build tools.

i tested windows sdk 7 with eclipse neon. you can find a quick installation guide here.

but i don't know what will happen with visual c++ 2015 build tools. this tools is introduced in my blog - even written in korean but with full of images.

then, you can find my another answer.

finally, you have two check points comparing with what you have done.

the one is

enter image description here

anther one is

enter image description here

score:0

run eclipse from developer command prompt. if you added all include paths, but <windows.h> could't be resolved and fatal error c1083: cannot open include file: 'winapifamily.h' occurs then to all configurations and all languages (checkboxes) project -> properties -> c/c++ general -> paths and symbols -> include directories -> add...

  • program files (x86)\windows kits\8.1\include\um
  • program files (x86)\windows kits\8.1\include\shared

and don't forget project -> c/c++ index -> rebuild

if there is fatal error lnk1104: cannot open file 'kernel32.lib' and ucrt.lib in project -> properties -> c/c++ build -> settings -> linker (link) -> libraries -> additional libpath (/libpath) add...

  • program files (x86)\windows kits\8.1\lib\winv6.3\um\x86
  • program files (x86)\windows kits\10\lib\10.0.10240.0\ucrt\x86

or (x64, arm, etc...) for configuration: all configurations

also know, that you could't debug with cdb & through the years eclipse keeps brand

score:8

steps to get eclipse building "hello world" with msvc:

  1. install visual studio (should work with vs 2017, vs 2019, and maybe earlier).
  2. install eclipse ide for c/c++ developers.
  3. in eclipse, go to "help / install new software...". under "work with...", select the cdt software update site.
  4. under "cdt optional features", select "c/c++ visual c++ support". install it and restart eclipse, then close eclipse.
  5. from the windows search/run bar, start "developer command prompt for vs 2019" (or earlier version). you should now have a command window and prompt.
  6. run "set", and observe that there's a ton of vs-specific environment variables present.
  7. enter the full program path to eclipse (e.g. c:\users\drodgers\eclipse\cpp-2019-12\eclipse\eclipse.exe), and hit enter. you're now running eclipse again, but with all the vs environment variables present.
  8. create a new c++ managed build project. enter a project name, select "hello world c++ project", and select microsoft visual c++ as the toolchain. finish creating the project.
  9. in the main source file, you should see an orange squiggle under #include <iostream> and red squiggles under std, cout, and endl because eclipse doesn't know where to find all the include files. let's fix that.
  10. in project explorer, right-click on the project name, select "properties", then select "c/c++ general / paths and symbols". with the "includes" tab in view, select "add...", you'll get an "add directory path" dialog. click "variables...", wait a moment, then select "vctoolsinstalldir", which will fill ${vctoolsinstalldir} in the dialog (or just type it). then append /include so that it reads ${vctoolsinstalldir}/include. (backslash works too... but see below.) check the "add to all configurations" and "add to all languages" boxes. your dialog should look like this:

setting the include path to vc include files

  1. click ok, then click apply and close. if you're prompted to rebuild the index, say yes. the orange squiggle for the include should go away, and once the index is rebuilt, the red squiggles should go away, too (do a manual index rebuild if necessary - right-click project, select "index / rebuild".
  2. right-click your project, and select "build". it should now build successfully., like so:
21:12:43 **** rebuild of configuration debug for project wibble ****
info: internal builder is used for build
cl /c /ehs /md /zi "/ic:\\program files (x86)\\microsoft visual studio\\2019\\community\\vc\\tools\\msvc\\14.24.28314\\\\include" /nologo "/fosource\\wibble.obj" "..\\source\\wibble.cpp" 
wibble.cpp
link /debug /nologo /out:wibble.exe "source\\wibble.obj"

21:12:44 build finished. 0 errors, 0 warnings. (took 1s.594ms)
  1. verify that you can run your new executable by browsing to your project location, going into the "debug" directory, launching a command prompt, and running the exe that's there. you should see "hello world" appear in your console window.
  2. to further simplify your launch process, create a subdirectory under your user directory (e.g. c:\users\drodgers\batch), create eclipse.bat containing the full path to eclipse, and then edit your environment variables to add the new directory to your user variables' "path" setting. now when you run the dev command prompt, you only have to type eclipse to launch eclipse.

(disclaimer: i can't take full credit for this answer, because i found the guts of it here. but i couldn't find a so post that offered this solution, so i'm posting it myself.)

edit: been playing a bit more, and there's some quality of life stuff that needs to be added. for whatever reason, ms doesn't include ctype.h or a number of other "standard" headers in its main include directory, so items like isxdigit() will be flagged red as function isxdigit() could not be resolved. to fix this:

  1. as referenced in a comment to the accepted answer for this question, for vs 2017 or 2019, you should install the "windows universal crt sdk" component using the vs installer app.
  2. close eclipse, relaunch the vs 2019 developer command prompt, and relaunch eclipse.
  3. in your eclipse c++ project, under "paths and symbols", specify these two directories: ${vctoolsinstalldir}/include and ${windowssdkdir}/include/${ucrtversion}/ucrt. note i used forward slashes; they work fine with eclipse on windows systems. if i use backslashes in that second path instead, eclipse starts invoking substitution escapes and you won't get the right path, so don't do that.

now you shouldn't have any unresolved symbols in your editor (at least for standard c/c++ stuff).


Related Query

More Query from same tag