At first I am trying to use glad.h in my project. Xcode 7.2.1. gives me the error :
glad.h:26:2: OpenGL header already included, remove this include, glad already provides it.
These are the headers in my main.cpp :
#include "glad/glad.h"
#include <iostream>
#include "GLFW/glfw3.h"
I add GLFW_INCLUDE_NONE to packaging - preprocessor definitions and LLVM - preprocessor macros(similar to preprocessor definitions in Visual Studio I guess?). Then the errors turn to:
Undefined symbols for architecture x86_64:
"_glfwCreateWindow", referenced from:
_main in main.o
"_glfwGetPrimaryMonitor", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I remove the code #include "glad/glad.h”, the errors remain the same.
Any help is appreciated.
Related
I am trying to compile main.ccp to configure my c++ project manually and have it connect to my own firebase.
#include "main.hpp"
#include <iostream>
#include "firebase/app.h"
#include "firebase/database.h"
int main()
{
firebase::AppOptions secondary_app_options;
secondary_app_options.set_api_key("API_KEY");
secondary_app_options.set_app_id("APP_ID");
secondary_app_options.set_project_id("PROJ_ID");
firebase::App* secondary_app = firebase::App::Create(secondary_app_options, "Secondary");
firebase::database::Database* secondary_database = firebase::database::Database::GetInstance(secondary_app);
return 0;
}
I use the command line to compile : g++ -std=c++11 main.cpp -o main.o
And it output:
Undefined symbols for architecture x86_64:
"firebase::App::Create(firebase::AppOptions const&, char const*)", referenced from:
_main in main-9988c0.o
"firebase::database::Database::GetInstance(firebase::App*, firebase::InitResult*)", referenced from:
_main in main-9988c0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did correctly download and locate all of the framework and library for firebase already. Can anybody help me with this ?
I'm using Eclipse and have been including the relevant libraries in the project folder as I build. Now that I'm a bit further in the course, I'm trying to
#include "vector.h"
but building gives 16 warnings that look like:
In file included from ../CS106B_Prog_Ass01_05.cpp:6:
Finished building: ../CS106B_Prog_Ass01_05.cpp
../vector.h:560:26: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
and the following error that prevents the project from building:
Undefined symbols for architecture x86_64:
"mainWrapper(int, char**)", referenced from:
_main in CS106B_Prog_Ass01_05.o
"__mainFlags", referenced from:
_main in CS106B_Prog_Ass01_05.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CS106B_Prog_Ass01_05] Error 1
I would love to simply link to the library folder, but that results in a similar error even if I switch it to a different architecture. Has anyone had this problem?
I'm struggling with a Linker error in Xcode. I've created the amalgamated source, added the jsoncpp.cpp as a source file to my project, I've set the header search path to jsoncpp-master/dist and use
#include "json/json.h"
#include "json/json-forwards.h"
as described at https://github.com/open-source-parsers/jsoncpp. Still, I'm getting an undefined symbols error:
Undefined symbols for architecture x86_64:
"output(Json::Value)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I found that it works if json/json.h, json/json-forward.h and jsoncpp.cpp are copied to the project directory. jsoncpp.cpp is added as a source file and json/json.h as a header. However, NO additional header search paths are set.
Undefined symbols for architecture x86_64:
"makeHero(std::string, int)", referenced from:
makeCard() in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is the error I am getting when I'm trying to compile my code on Xcode. I've looked around and I have changed Architecture settings to Universal, and have made c++ std library, libstdc++, which were answers I found on here. Still nothing :/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
Is the beginning of my main.cpp file whats causing it? I changed stdlib.h and stdio.h to without the .h and I get stdlib file not found.
Undefined symbols for architecture x86_64
This error message is rather misleading, what it's really telling you is that the compiler has seen a function declaration (symbol) for makeHero(std::string, int), but can't find its implementation.
The error is simple to reproduce by declaring a function in a header file, without implementing the function's body in either the header or cpp.
To fix the problem, ensure the body for the function is implemented in the project.
I'm trying to write some C++ functions that can be run from Lua. However, when I try to import the header files, I get the following error:
Undefined symbols for architecture x86_64:
"_luaL_loadfilex", referenced from:
_main in main.o
"_luaL_newstate", referenced from:
_main in main.o
"_luaL_openlibs", referenced from:
_main in main.o
"_lua_close", referenced from:
_main in main.o
"_lua_pcallk", referenced from:
_main in main.o
"_lua_pushcclosure", referenced from:
_main in main.o
"_lua_setglobal", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've already added the file path to the Header Search Paths option in the Build Settings.
Here is the import code:
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
What am I doing wrong?
For a first working version, get the library here, extract the header files and the .a file into the same directory as the project file which has the code you posted in your question, then try to compile and link normally.
You may keep the references locally as in your question:
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
Later you refine your environment if that is needed.
The error you are getting is a link error not a compile error. The linker (called "ld") is complaining that it can't resolve symbols related to Lua. Make sure you have -llua52 in your link command so your library links to the Lua shared library (might be -llua or -llua5.2 on your system), and tell the linker where to find that lib via -Lpath/to/Lua/lib/folder.