I would like to build two C ++ projects in the same solution in Visual Studio 2010 that can interact with each other. I created a solution under the directory C:\Users\me\Desktop\SolutionDir . These two projects were created respectively in C:\Users\me\Desktop\SolutionDir\FirstProject and C:\Users\me\Desktop\SolutionDir\SecondProject .
My first project contains two files: the function.h header and the cpp function.cpp file
function.h
#pragma once void print_stuff();
function.cpp
#include "function.h" #include <iostream> void print_stuff() { std::cout << "hello world" << std::endl; }
My second project contains the main main.cpp file
main.cpp
#include "FirstProject\function.h" #include <iostream> int main(void) { print_stuff(); int stop; std::cin >> stop; return 0; }
I added the C:\Users\me\Desktop\SolutionDir\ directory to my second Configuration Properties > C/C++ > General > Additional Include Directories project. I still get the classic error: error LNK2019: unresolved external symbol when calling print_stuff() .
Any ideas?
c ++ unresolved-external include visual-studio-2010 multiple-projects
vanna
source share