VS Visual GDB intellisense not finding library, but compiles properly - c

In particular, #include "sqlite3.h" gives an error [Clang Intellisense] Error: 'sqlite3.h' file not found in Visual Studio.
Everything works fine when compiling/running, but the intellisense errors are annoying.
I've installed sqlite3-dev and ran updates/upgrades.
I see sqlite3.h in the usr/include directory which is included in the list of intellisense directories under project properties.
sqlite3 is included in the Library names (Makefile settings -> Config settings)
Is my path going to the wrong library or am I just missing something simple? I don't see the sqlite.c file in there and looking the the .h file, I don't see the functions I am using (from an example) like SQLITE_OK or sqlite3_free.
Again, everything works, it's just the intellisense that doesn't work. At least from what I can tell so far.
Oh, and the code is running on raspbian if that matters.

Yes, I experience the same the first time I open the solution. But I managed to get rid of it by opening one of the included header files and a clean Rebuild.
my VS version is 2015

Related

Why Visual Studio Code can't compile my C code?

I have a problem which is: VSC can't compile my C code as the title said. I have looked for the problems and did all what was necessary:
installed msys
installed mingw
installed C/C++ extensions
added code runner
Yet the problem is still showing like this:
gcc.exe: error: name.c: No such file or directory
(Note that I'm an absolute beginner when it comes to using VSC and don't have any background in coding so I'd appreciate it if I get to know the solution by simple vocabulary :) )
It seems like your c file('name.c') is not located in your working directory.
Moving your c file to your project folder may solve your problem.
To check your working directory, choose terminal tab and type 'pwd'.

VS Code: command-line error:missing source file name

This is picture of my screen: This error shows up when I enter #include <stdio.h>to begin my program. I'm not sure how to fix this. Every file in Visual Studio Code is now having this issue.
I use gcc. gcc -o outputname filename.c and using C/C++ IntelliSense, debugging, and code browsing extension by Microsoft.
As you didn't explain the question well.
I think that there is a macro in the build options that is not defined so it gets inserted into the build command as a blank string. Does your project use some macros in the build options maybe something for 55x CSL directory?
If so make sure to define these macros on the macro tab of the build options dialog.
Various things may contribute to this error:
unclosed quotes in preprocessor definitions, macros or even c_cpp_properties.json
file encoding
the VS Code cpp extension
It has come and gone in my c/c++ development, and I don't know if anything specific I've done fixes it or if just restarting VS Code is the solution.
Most recently, I
changed the encoding of all files from UTF-8 to ANSI (in case there were any hidden unicode characters in the file, which happens with copy & paste sometimes)
restarted VS Code
it then complained that the c/c++ extension wasn't installed (it was?) and so I installed it again, and the error is gone.
I had the same issue. I just uninstalled and reinstalled the c/c++ extension and it was back to normal
I ran into the same problem this morning. IntelliSense was at fault.
Only solution I quickly had found for me was to hard-delete C++ IntelliSense extension. Plain uninstall did not help.
You can remove IntelliSense Extension this way:
close all instances of Visual Studio Code,
navigate to folder %USERPROFILE%\.vscode\extensions
delete a folder/folders (incl. subfolders) ms-vscode.cpptools*
start Visual Studio Code again and install fresh IntelliSense extension.
NOTE: you may lose your IntelliSense custom settings!

Unable to compile or run sqlite3 using Visual Studio 2015

I'm trying to compile the source of sqlite3.c and shell.c I downloaded from the SQLite website using Visual Studio 2015. I created DLL project sqlite3 and put the sqlite3.c source into it. Then I created project sqlite3shell and put shell.c source into it. I added include "stdafx.h" into both. When I compiled both projects the DLL did not produce a .lib file, so the compile of sqlite3shell got the error LNK1104 cannot open sqlite3.lib.
I manually created a .lib file using this solution. Then the sqlite3shell program compiled successfully. But when I went to run the program, I got the error The application was unable to start correctly (0xc000007b). Looking into this error is seems one reason it could be caused is by trying to access a 64-bit program from a 32-bit program. But everything was created using the x86 configuration.
Is there some way to have the DLL compile produce the correct .lib file? Or if that won't fix the problem, is there something I can do to prevent the 0xc000007b error?
In case someone else should have this problem, I have found the solution. There were 2 lines that specified the define of SQLITE_API. I added the export to the define like this: # define SQLITE_API __declspec(dllexport). Apparently there were no exports, so that was why the .lib file was never created. With the change, the .lib and .exp files were created and then the program didn't get the 0c000007b error.

Linker warnings with GLFW

I am trying to use GLFW for a school project, and have followed these steps:
1) Download the win32 zip from glfw.org
2) Add /include to my solution's includes
3) Add /lib-msvc100/debug to my solution's libraries
4) Link against glfw.lib and opengl32.lib
5) #include GL/glfw.h
While the project compiles and runs just fine, I can't get around a slew of the following errors:
Warning LNK4099: PDB 'vc100.pdb' was not found with
'glfw.lib(enable.obj)' or at '-projectdir-\Debug\vc100.pdb'; linking object as if no
debug info
One other post here (LNK4099 in GLFW console project with debug configuration) talks about accidently linking both static and dll, but I have not done so. I cannot submit a project with compilation errors :-/
Any idea what's going on here, and how to fix it? Much obliged
You are using the debug version of the GLFW binary, but the vc100.pdb debug information database wasn't included in the zip file. It's a relatively harmless warning and simply means you won't be able to debug normally inside GLFW functions. However, you wouldn't be able to anyway, as the zip file doesn't have the GLFW sources either.
This solved the problem for me:
Open the GLFW project in the solution and go to C++ general options. For all platforms, change the debug build's "debug information format" to "Program Database". Recompile.

Why Isn't My C Code Being Compiled To An EXE

I'm just starting out writing trying to write a simple program in C and I am using Visual Studios to do so. I heard that it does compile C as well as C++. And I know that it does because it says it compiles. The only problem is that when I go to the output directory, there isn't a .exe file in the directory! It has the following:
BuildLog.html
mt.dep
test1.obj
vc90.idb
vc90.pdb
But that is all! No EXE. I've looked through all the options and made sure that it is set to compile to an exe and i checked the output file. That is $(OutDir)\$(ProjectName).exe. But alas, no exe appears. Any ideas?
Also when i try to hit f5 and run with debut i get an error that says
This application has failed to start
because MSVCR90.DLL was not found.
Re-installing the application may fix
this problem
By default when you're creating a new C++ project within a new solution, you're getting folder structure like this:
C:\Projects\YourSolution
C:\Projects\YourSolution\YourCppProject
YourSolution contains YourSolution.sln and YourCppProject contains YourCppProject.vcproj.
When you build the solution, all intermediate files from YourCppProject are getting stored under YourCppProject\Debug or YourCppProject\Release, but resulting YourCppProject.exe goes under YourSolution\Debug or YourSolution\Release.
Your $(OutDir) is configured by General -> Output Directory. Check project configuration for YourCppProject and see that it uses $(SolutionDir) for the output.
is it a C/C++ console application?
did you use the project wizard to create it?
do you have a function like
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
printf("Hello, world!\n");
return 0;
}
in a .c module, typically main.c?
what happens when you hit F5 to run-with-debug?
what does your build log look like?
The simplest thing to do is just start over, making sure you choose the right kind of project.
To compile plain old C code with Visual Studio, choose Visual C++ > General > Empty Project from the New Project menu. This creates 3 empty folders: Header Files, Resource Files, and Source Files. Right click on Source Files, choose Add > New Item. Then add a main.cpp, rename it to main.c, and start coding.
http://msdn.microsoft.com/en-us/library/ms235299.aspx
Note:
It is not supported to redistribute
C/C++ applications that are built
without a manifest. Visual C++
libraries cannot be used by C/C++
applications without a manifest
binding the application to these
libraries. For more information, see
Choosing a Deployment Method.
If the DLL is not reachable and
Windows cannot load this DLL for your
application, you may get the following
error message:
This application has failed to start
because MSVCR90.dll was not found.
Re-installing the application may fix
this problem.
To resolve these errors, you must make
sure that your application is built
correctly and Visual C++ libraries are
correctly deployed on the target
system. To identify the root cause of
these run-time errors, follow the
steps outlined in Troubleshooting
C/C++ Isolated Applications and
Side-by-side Assemblies.
HTH
Sounds like you only hit compile, that will give you you're .obj file, but you still need to click build.

Resources