Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Configuring Eclipse for VS Compiler
Configuring Eclipse for VS Compiler [message #556317] Tue, 31 August 2010 18:13 Go to next message
MM is currently offline MMFriend
Messages: 2
Registered: August 2010
Junior Member
Hi,

when I started programming C++ I used Eclipse CDT + MinGW. Soon enough I realized that all the roads lead to Visual Studio so I switched to VS. I have been using it since then but I don't really like it mainly because it slows down my system extremly. So I thought to myself: "Why not use Eclipse CDT with the VS compiler?".

Since I didn't find anything with google about this topic (At least nothing helpful) I tried it myself.
I added a custom builder and linked it to the "cl.exe" from Visual Studio. But I ran into a problem with the arguments. As a test I simply put this as arguments: "${build_project}\Test.cpp".
Of course the compiler said it couldn't find the iostream.h since I didn't specify any include directories in the arguments.
And here is the problem: I don't find a variable which gets the include directories which I specified in the "Paths and Symbols" section of the project settings.

So my question is how I can get these directories so I can specify them as arguments. Also the ${build_files} doesn't return the expected result. Help would be very appreciated since I don't know much about the functionality of Eclipse.

Thanks in advance.

[Updated on: Tue, 31 August 2010 18:48]

Report message to a moderator

Re: Configuring Eclipse for VS Compiler [message #556763 is a reply to message #556317] Thu, 02 September 2010 14:49 Go to previous messageGo to next message
MM is currently offline MMFriend
Messages: 2
Registered: August 2010
Junior Member
So I realized that I have to use a toolchain to be able to use the VC++ Compiler effectively with Eclipse CDT.
I found a pretty solid one here.
After adding the include and library paths I tried to build a very simple program which simply outputs "Hello world".
It failed with the following output:

Quote:
cl /c /EHs /MD /Zi /IC:\Program Files\Microsoft Visual Studio 9.0\VC\include /nologo /Foprogram.obj ..\program.cpp
Build error occurred, build is stopped


It seems like the compiler isn't even started. I suspect that it can't find the mspdb80.dll since it isn't in the same directory as the cl.exe. So my question is how I can set the Working Directory to the "Common7/IDE" directory? Any ideas?
Re: Configuring Eclipse for VS Compiler [message #556869 is a reply to message #556763] Thu, 02 September 2010 22:15 Go to previous messageGo to next message
Austin Morgan is currently offline Austin MorganFriend
Messages: 42
Registered: July 2009
Member
You should include the path to cl in your environment path, not change
your working directory to the path of the application.

On Thu, Sep 02, 2010 at 10:49:57AM -0400, MM wrote:
> So I realized that I have to use a toolchain to be able to use the VC++ Compiler effectively with Eclipse CDT.
> I found a pretty solid one http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/win dows/?root=Tools_Project
> After adding the include and library paths I tried to build a very simple program which simply outputs "Hello world".
> It failed with the following output:
>
> Quote:
> > cl /c /EHs /MD /Zi /IC:\Program Files\Microsoft Visual Studio 9.0\VC\include /nologo /Foprogram.obj ..\program.cpp
> > Build error occurred, build is stopped
>
>
> It seems like the compiler isn't even started. I suspect that it can't find the mspdb80.dll since it isn't in the same directory as the cl.exe. So my question is how I can set the Working Directory to the "Common7/IDE" directory? Any ideas?
Re: Configuring Eclipse for VS Compiler [message #663961 is a reply to message #556869] Wed, 06 April 2011 23:15 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: April 2011
Junior Member
1. create new run config in eclipse
2. set arguments to:
"${workspace_loc}${resource_path}" "${resource_name}" "${project_loc}"

3. create batch file from below code and set as c++ application
4. change path at beginning of batch file to match your c++ installation
5. select and open source file .cpp in eclipse and click run...works for me for single source files. dont know about depencencies


CODE BATCH FILE
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" & cl /EHs %1 & for /f "tokens=1,2 delims=." %%a in ("%2") do set filename=%%a&set fileext=%%b & cd %3 & %%a.exe

Re: Configuring Eclipse for VS Compiler [message #664468 is a reply to message #663961] Sat, 09 April 2011 08:29 Go to previous messageGo to next message
Loaden  is currently offline Loaden Friend
Messages: 14
Registered: September 2009
Junior Member
Why not using CMake for VC Compiler support?
Re: Configuring Eclipse for VS Compiler [message #1712851 is a reply to message #664468] Wed, 28 October 2015 18:42 Go to previous messageGo to next message
Nicholas Warren is currently offline Nicholas WarrenFriend
Messages: 5
Registered: October 2015
Junior Member
The error I'm currently getting is:

Invoking: Cygwin C++ Compiler
g++-std=c++11 -std=c++0x -D__GXX_EXPERIMENTAL_CXX0X__ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Source.d" -MT"Source.o" -o "Source.o" "../Source.cpp"
/bin/sh: g++-std=c++11: command not found
subdir.mk:18: recipe for target 'Source.o' failed
make: *** [Source.o] Error 127


Which I cannot find a work around for or setting which I have changed incorrectly to remedy.
Re: Configuring Eclipse for VS Compiler [message #1713152 is a reply to message #1712851] Sun, 01 November 2015 14:35 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Eclipse is trying to use g++ and not cl. You will need to change the compiler command in Project ==> Properties ==> C/C++ Build ==> Settings in the Tool Settings tab at the very least.

To use the MS compiler and C++11 you should be aware of this:
http://stackoverflow.com/questions/19857263/how-to-activate-c11-standard-in-visual-studio-2010

Previous Topic:CDT Installation on Luna - "cannot perform operation"
Next Topic:C and Python, Mixed Mode Debug
Goto Forum:
  


Current Time: Fri Apr 19 22:17:24 GMT 2024

Powered by FUDForum. Page generated in 0.03973 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top