Sorry if the title is a bit off, I couldn't think of what to call it.

I've created projects in VS, and they all run perfectly fine. However, I now just want to create the source files then compile via the command line. I've done this rather easily, but now that I've tried to link to libraries ( SDL particularly ) I'm at a loss.

I honestly just want to know how to link to library files in SDL without having to use the IDE provided for Visual Studio.

Also, as this might just solve the bigger problem I'm having, I wanted to know if you could disable VS from creating all the folders and debug files it does when compiling using the IDE. The whole reason I'm using the command line is that every project I make creates several files I don't want. I just want the .cpp file, the .obj file, and the .exe file ( along with any dependencies I may require ). Using other compilers ( and the command line VS compiling ) this is what I get. However, I'm not sure how to change this. If someone could tell me how, that would solve a bigger issue for me.

Thank you!

Recommended Answers

All 2 Replies

The command-line compiler is cl.exe. In a command prompt window (DOS box), first run vcvars32.bat found in the compiler's install bin directory. That will set all the environment variables needed to run cl.exe

cl.exe uses many of the flags that are commonly found in make files. /I followed by include directory, and /L followed by library directory. So if you want to compile and link myprogram.cpp with mylib.lib cl myprogram.cpp mylib.lib -o myprogram.exe /L c:\mylibs This can all get very complicated if you don't use a makefile and nmame.exe utility.

Thanks for the response. I've been rattling it around my head, and I've finally decided I can just stick with the stuff VS provides with it's environment. They are usefull, but very bulky to me. I've used other compilers ( VS having the best for Windows so far, next to gcc ) and their environments usually have the customizability to easily set what you want it to create and what not to. They also make it easy to link to any library that is external to the standard, rather than going through most of the garbage ( I say garbage only due to how much of it isn't used by beginner-intermediate programmers, and even several advanced ) features that Visual Studio provides.

All-in-all, I just wish it was more lean and mean rather than bulky with so many unnecessary features and inclusions. I'll try a little longer to work along with the command line for VS, as well as the command line for another compiler ( MinGW ) and see if I can't get something worked out. If not, no harm in using the bulky stuff, just feels someone unorganized. Though I'll spend a few more hours looking through to at least customize what it will make/not make and where it will put it. If that works, I'll be set!

Thanks again ( and sorry for the long reply ). Marking as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.