Include tcl.h into C project - c

I need to use tcl.h in my C project (VS 2012) for registering function in SQLite. I have downloaded Tcl for windows and installed it. But my project still doesn't recognize when I write #include . What should I do to get access to this header?
Thanks in advance.

Open the project properties and do :

Right click on your project, go to properties, go to C/C++ session. On the field Additional Include Directories, add the path to the header you want, and use the header with "".
After that, you should go to the Linker session. On General, go to the Additional Library directories and add the path to the libs you need to add. Then go to Input and add the lib.
Sometimes you will need to copy a dll to the same folder of your executable. You can do that on Custom Build Step - Post Build Events.
You need to do it for each configuration and platform you want to build - one tip to make it easier is to use those variables $(Configuration) and $(Platform) when you are specifying the paths, and select on the dropdown list of the top of the properties window All configurations and All platforms, so you don't need to do it several times per project.

Related

Automatically defining C/C++ include path on WSL Visual Studio Code

When using the C/C++ extension for Visual Studio Code with WSL, it will never refer to /usr/include/ unless you create a project file any time, as you have to allow it to create a local config file called c_cpp_properties.json. This means you simply cannot run standalone C files unless you create a workspace around it.
Is there some way to automate this, even a little? It's very annoying having to redefine my standard includes every time I reopen the program.
Ideally I would like to set this up such that I can just work with my C files standalone rather than as a project as I am frequently using university assets and it's very annoying to have to create a project to work with any demo they give me. I have looked everywhere but just can't find any kind of global setting where I can tell the extension to refer to /usr/include/ - with or without a local config file for the project.
Thanks

Using multiple main files in VS2017

I've downloaded VS2017 Community Edition and I'm working through "Programming in C" by Stephen G. Kochan.
I'd like to store all the examples in one project (possibly 1 project per chapter), however I've come across the error about multiple "main" files in one project. Before telling me I can't have multiple main's in a project, could you suggest the best way to organise these small C programs in VS2017.
I love the fact that I don't have to use a terminal compiler and would like to use VS2017 to work my way through the book.
Any suggestions?
A typical case of "assignments" in a course. In that case you can create one module (c file) for each assignment and call the current assignment from your main. Now you have all assignments in a single project, so you can easily look them up. Assignments completed you can comment-out.
I don't think you really want them all in one project. I think you want them all in one Solution, with each example in its own Project. That way you can switch between projects in the IDE and build/run/debug whichever one you are working on at the time.
Add a new project to your solution by right-clicking the solution in Solution Explorer and selecting Add->New Project from the menu.
Set the active project by right-clicking the project in Solution Explorer and choose "Set as startup project" from the menu.
This allows you to build each example on its own, or build all of them at once. Each project is self-contained and generates its own executable, and you can navigate around from one project to another inside the IDE.
You can compile and run your C files individually from command line.
This is not ideal when using an IDE.
Your other option is to use add_executable command in cmake
Adds an executable target called to be built from the source
files listed in the command invocation. The corresponds to the
logical target name and must be globally unique within a project. The
actual file name of the executable built is constructed based on
conventions of the native platform (such as .exe or just
).

Using Eclipse for C/C++ development without changing existing project directory structure

I have mostly used kate, vim etc to code and just pure console and gdb (rarely) to test. I want to start using eclipse, mainly for ease of looking up stuff, and hopefully (while not super important,) run the GUI debugger.
However, I don't want eclipse to touch my real project folders (it should change the code, obviously, but don't want it to create any configuration folders etc). Is that possible? I was thinking to create a workspace on a different folder, and add sources from my project path. But this seem to be complicated without any experience with eclipse when handling Makefiles etc!
Anyone has done something similar? any guidelines?
Yes, this is fairly straightforward. Instead of creating a standard C Project that creates and manages makefiles for you, use the "Makefile Project with Existing Code" instead.
If you don't want the .cproject, .project, etc files intermixed, create the CDT project in an empty directory and use Linked Files and Folders to pull in what you do want in the project.
If you do try to do a Build within Eclipse it will do "make all", but if you don't have a Makefile you get this (same for clean):
make all
make: *** No rule to make target `all'. Stop.
What I have done is for projects that don't have a make equivalent (like CPython extension) is to write a trivial Makefile that delegates all and clean targets to my real tool.
Once you have the project created, you will need to configure it to get all the goodness of CDT. The CDT Indexer and Scanner needs to know about your compiler settings (includes and defines really). There are two ways of delivering that information:
Run a verbose build (i.e. with gcc command line arguments echoed) from within Eclipse (e.g. use trivial Makefile described above). CDT will parse that output and automatically pick up compiler options used.
There are a number of ways that CDT can learn about what your settings are, to configure how they are picked up, head to project properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. and adjust the sources in the Providers tab:
In the project properties, edit the C/C++ General -> Paths and Symbols properties. You may have to do this if CDT cannot determine all your settings in Step 1 too. This is a screenshot of some of those settings:

Eclipse: choosing a default debugger for all new C projects

Whenever I start a new project, I have to go through setting up the debugger with Eclipse time and time again before I can use it. Isn't there a default setting for all new C projects I can change?
I'm not sure exactly what you mean by "setting up the debugger" (perhaps you can clarify), but under "Preferences -> Run/Debug -> Launching -> Default Launchers" you should be able to select your preferred launcher for different kind of launch modes. This can also be selected individually for each launch configuration.
Typically it is up to the toolchain and/or project to determine which debugger/launcher is suitable to use for that specific project, but I know there is a bug in CDT which prevents toolchains from properly specifying the default launcher to use.
I only use Eclipse for Java, so I can't give you an authoritative answer. But since no one else seems to be answering:
Java projects have a (more or less) hidden file in the project directory called .project and another one called .settings . I'm not sure if this would apply to the C environment as well, but it seems likely. You may want to look at the set of such "hidden" files for a well set up project and a virginal project side by side to find out which settings make the difference.
Given that information, you may be able to simply edit (perhaps with some assistance from a script you can write yourself) the file(s) in question to do the configuration textually without a lot of mouse clicking.

Inno Setup installer package supplied file list

I've got a "Project" containing a mixed set of files that my application compiles into an installable using InnoSetup. Many of the project files are system or configuration files, and not relevant to the actual install. Therefore, i want to include only the relevant files in an installer. I have a list of them in my application, but no way to inject this information into the template Inno setup script.
What options are available to achieve this?
Regards
Tris
Note: The files are too big to really be copied in a reasonable length of time. :)
sorry for being so late...and then just asking the obvious: why can't you just keep irrelevant files out of the Inno-Script? Do I understand right: you have an app that generates a setup-script for InnoSetup based on a template? Can't you then modify the app? Alternatively, any chance to edit the ISS and remove the irrelevant files?
Cheers
Michael

Resources